Remove CMSException.
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 2 Feb 2021 19:32:23 +0000 (20:32 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 2 Feb 2021 19:32:23 +0000 (20:32 +0100)
org.argeo.cms.ui/src/org/argeo/cms/ui/util/DefaultImageManager.java

index d99be6b02c3a9482ded01faf2254ed96a98158b3..698ab1b0692daf1a29225314465ccc8c153be119 100644 (file)
@@ -20,7 +20,6 @@ import javax.jcr.RepositoryException;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.argeo.cms.CmsException;
 import org.argeo.cms.ui.CmsImageManager;
 import org.argeo.jcr.JcrUtils;
 import org.eclipse.rap.rwt.RWT;
@@ -104,7 +103,7 @@ public class DefaultImageManager implements CmsImageManager {
                } else if (constraints.x == 0) {// force height
                        return new Point(scale(orig.x, orig.y, constraints.y), constraints.y);
                }
-               throw new CmsException("Cannot resize " + orig + " to " + constraints);
+               throw new IllegalArgumentException("Cannot resize " + orig + " to " + constraints);
        }
 
        private int scale(int origDimension, int otherDimension, int otherConstraint) {
@@ -220,7 +219,7 @@ public class DefaultImageManager implements CmsImageManager {
                        }
                        return CmsUiUtils.getDataPath(fileNode);
                } catch (IOException e) {
-                       throw new CmsException("Cannot upload image " + fileName + " in " + parentNode, e);
+                       throw new RuntimeException("Cannot upload image " + fileName + " in " + parentNode, e);
                } finally {
                        IOUtils.closeQuietly(inputStream);
                }