Description
Sometimes an image upload fails. This can happen for instance if there is an unsupported color scheme, causing a javax.imageio.IIOException: Unsupported Image Type. In a known case it was caused by a jpeg image with CMYK colors. Detailed stacktrace below. It is reproducable in Go Green, see screenshots.
The handling of such error can be improved. It looks like the upload has succeeded but the image size is -1 bytes. Then, after hitting the Edit-button, an error occurs showing jcr:data to be empty. Then, the state of the application may be corrupted so that following image upload/edits fail also (state is good again with logoff/logon).
What I'd expect is that when image upload fails, no new image is created whatsoever.
Stacktrace on failing image:
WARN [org.hippoecm.frontend.plugins.gallery.processor.ScalingGalleryP
rocessor.initGalleryResource():108] Scaling failed, using original image instead
org.hippoecm.frontend.plugins.gallery.model.GalleryException: Could not execute image operation
at org.hippoecm.frontend.plugins.gallery.imageutil.AbstractImageOperation.execute(AbstractImageOperation.java:57)
at org.hippoecm.frontend.plugins.gallery.processor.ScalingGalleryProcessor.initGalleryResource(ScalingGalleryProcessor.java:102)
at org.hippoecm.frontend.plugins.gallery.processor.AbstractGalleryProcessor.makeImage(AbstractGalleryProcessor.java:93)
at org.hippoecm.frontend.plugins.gallery.GalleryWorkflowPlugin.createGalleryItem(GalleryWorkflowPlugin.java:159)
at org.hippoecm.frontend.plugins.gallery.GalleryWorkflowPlugin.access$100(GalleryWorkflowPlugin.java:70)
at org.hippoecm.frontend.plugins.gallery.GalleryWorkflowPlugin$UploadDialog.handleUploadItem(GalleryWorkflowPlugin.java:92)
at org.hippoecm.frontend.plugins.yui.upload.MultiFileUploadDialog$2.onFileUpload(MultiFileUploadDialog.java:66)
at org.hippoecm.frontend.plugins.yui.upload.FileUploadWidget$1.onFileUpload(FileUploadWidget.java:111)
at org.hippoecm.frontend.plugins.yui.upload.ajax.AjaxMultiFileUploadComponent$UploadBehavior.onRequest(AjaxMultiFileUploadComponent.java:68)
at org.apache.wicket.request.target.component.listener.BehaviorRequestTarget.processEven(BehaviorRequestTarget.java:157)
<snip/>
at java.lang.Thread.run(Thread.java:662)
Caused by: javax.imageio.IIOException: Unsupported Image Type
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:977)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:948)
at javax.imageio.ImageReader.read(ImageReader.java:923)
at org.hippoecm.frontend.plugins.gallery.imageutil.ScaleImageOperation.execute(ScaleImageOperation.java:161)
at org.hippoecm.frontend.plugins.gallery.imageutil.AbstractImageOperation.execute(AbstractImageOperation.java:55)
... 36 more