ICEmobile
  1. ICEmobile
  2. MOBI-617

Camera component does not catch IOExceptions when decoding image upload

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2 Final
    • Fix Version/s: 1.3 Beta
    • Component/s: Faces
    • Labels:
      None
    • Environment:
      n/a

      Description

      The camera component does not properly handle the IOExceptions coming from reading an image upload, as can be seen from this stack trace:

      INFO: Adapting to Thread Blocking environment
      java.lang.NullPointerException
              at org.icemobile.util.Utils.copyStream(Utils.java:94)
              at org.icefaces.mobi.utils.MobiJSFUtils.createMapOfFile(MobiJSFUtils.java:171)
              at org.icefaces.mobi.utils.MobiJSFUtils.decodeComponentFile(MobiJSFUtils.java:137)
              at org.icefaces.mobi.component.camera.CameraRenderer.extractImages(CameraRenderer.java:79)
              at org.icefaces.mobi.component.camera.CameraRenderer.decode(CameraRenderer.java:51)
              at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:787)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1181)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIForm.processDecodes(UIForm.java:225)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIComponentBase.processDecodes(UIComponentBase.java:1176)
              at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:933)
              at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at com.icesoft.servlet.MultipartFilter.doFilter(MultipartFilter.java:74)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
              at java.lang.Thread.run(Thread.java:662)


      The decodeComponentFile is supposed to return a boolean indicating whether the file was successfully retrieved or not, but it does not catch any IOExceptions coming from Utils.copyStream. If it did it would be able to return false to properly indicate that the upload was not successful.

        Activity

        Hide
        Philip Breau added a comment -

        This can be easily reproduced in Mediacast with the following steps:

        1. in upload tab, take and upload an image
        2. click 'share'
        3. go to feed tab (small view)
        4. click on image in left menu (large view) or list (small view)

        The camera in this case after step 4 still tries to decode and assumes an image is being uploaded even though it's not.

        Show
        Philip Breau added a comment - This can be easily reproduced in Mediacast with the following steps: 1. in upload tab, take and upload an image 2. click 'share' 3. go to feed tab (small view) 4. click on image in left menu (large view) or list (small view) The camera in this case after step 4 still tries to decode and assumes an image is being uploaded even though it's not.
        Hide
        Ted Goddard added a comment -

        I was unable to reproduce the specific Exception above, but did see a similar Exception when attempting to upload no file after a successful file upload. This was due to application code initializing the file meta-information maps to empty, but clearing them to null. They are now cleared to empty maps.

        Show
        Ted Goddard added a comment - I was unable to reproduce the specific Exception above, but did see a similar Exception when attempting to upload no file after a successful file upload. This was due to application code initializing the file meta-information maps to empty, but clearing them to null. They are now cleared to empty maps.

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Philip Breau
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: