ICEfaces
  1. ICEfaces
  2. ICE-4743

NullPointerException with FileResource

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.1
    • Fix Version/s: 1.8.2-RC1, 1.8.2
    • Component/s: None
    • Labels:
      None
    • Environment:
      ICEfaces Core, Component Showcase

      Description

      I found multiple occurrences of these exceptions in the logs of Component Showcase. I'm not sure how to reproduce this.

      2009-07-21 23:13:19,500 ERROR [com.icesoft.faces.webapp.http.core.ReceiveSendUpdates] Exception occured during rendering on http://component-showcase-test.icefaces.org/component-showcase/block/send-receive-updates [/showcase.jspx]
      javax.faces.FacesException
              at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:107)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
              at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
              at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
              at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:132)
              at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:74)
              at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:28)
              at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
              at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
              at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
              at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:47)
              at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:22)
              at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
              at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:135)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
              at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
              at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
              at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
              at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
              at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
              at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
              at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
              at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
              at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
              at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
              at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
              at com.icesoft.faces.context.FileResource.withOptions(FileResource.java:29)
              at com.icesoft.faces.component.outputresource.RegisteredResource.withOptions(OutputResource.java:389)
              at com.icesoft.faces.webapp.http.core.ResourceDispatcher.registerResource(ResourceDispatcher.java:67)
              at com.icesoft.faces.context.BridgeFacesContext.registerResource(BridgeFacesContext.java:621)
              at com.icesoft.faces.context.BridgeFacesContext.registerResource(BridgeFacesContext.java:613)
              at com.icesoft.faces.component.outputresource.OutputResource.getResource(OutputResource.java:85)
              at com.icesoft.faces.component.dataexporter.DataExporter.broadcast(DataExporter.java:247)
              at com.icesoft.faces.component.panelseries.UISeries$RowEvent.broadcast(UISeries.java:610)
              at com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:275)
              at com.icesoft.faces.component.paneltabset.PanelTabSet.broadcast(PanelTabSet.java:318)
              at javax.faces.component.UIData.broadcast(UIData.java:677)
              at com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:270)
              at com.icesoft.faces.component.paneltabset.PanelTabSet.broadcast(PanelTabSet.java:318)
              at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:269)
              at javax.faces.component.UIViewRoot.processDecodes(UIViewRoot.java:327)
              at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:99)
              ... 36 more

        Activity

        Jack Van Ooststroom created issue -
        Hide
        Jack Van Ooststroom added a comment -

        Changed Fix Version(s) to 1.8.2

        Show
        Jack Van Ooststroom added a comment - Changed Fix Version(s) to 1.8.2
        Jack Van Ooststroom made changes -
        Field Original Value New Value
        Salesforce Case []
        Fix Version/s 1.8.2 [ 10190 ]
        Deryk Sinotte made changes -
        Assignee Mircea Toma [ mircea.toma ]
        Deryk Sinotte made changes -
        Salesforce Case []
        Assignee Priority P2
        Hide
        Mircea Toma added a comment -

        The exception is caused by "Data Exporter" component. It can be easily triggered by selecting a file type for data export, then select back the first option in the drop down and finally click on the link to download the file. Because there is no file type selected DataExporter.java component will return null instead of returning a file pointer. Later on when the file is served as FileResource the NPE exception is thrown.

        Show
        Mircea Toma added a comment - The exception is caused by "Data Exporter" component. It can be easily triggered by selecting a file type for data export, then select back the first option in the drop down and finally click on the link to download the file. Because there is no file type selected DataExporter.java component will return null instead of returning a file pointer. Later on when the file is served as FileResource the NPE exception is thrown.
        Hide
        Mircea Toma added a comment -

        Attached patch for DataResource.java. To avoid NPE exceptions a no-op ContentTypeHander is used so that a valid file is returned by DataResource.createFile() method.

        Show
        Mircea Toma added a comment - Attached patch for DataResource.java. To avoid NPE exceptions a no-op ContentTypeHander is used so that a valid file is returned by DataResource.createFile() method.
        Mircea Toma made changes -
        Attachment ICE-4743.patch [ 11900 ]
        Hide
        Mircea Toma added a comment -

        Adnan, please see my comments and review the patch I attached.
        In order to completely fix this issue I believe you should also hide "Click to download file" link when no file type is selected for export.

        Show
        Mircea Toma added a comment - Adnan, please see my comments and review the patch I attached. In order to completely fix this issue I believe you should also hide "Click to download file" link when no file type is selected for export.
        Mircea Toma made changes -
        Assignee Mircea Toma [ mircea.toma ] Adnan Durrani [ adnan.durrani ]
        Adnan Durrani made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Adnan Durrani added a comment -

        Changes looks good, and I have tested the patch as well. The patch has been checked in along with the change to not to render the download link until the type is defined.

        Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
        Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
        Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
        Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
        Completed: At revision: 19143

        Show
        Adnan Durrani added a comment - Changes looks good, and I have tested the patch as well. The patch has been checked in along with the change to not to render the download link until the type is defined. Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Completed: At revision: 19143
        Adnan Durrani made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Joanne Bai added a comment -

        verified with success on trunk revision 19173

        Show
        Joanne Bai added a comment - verified with success on trunk revision 19173
        Ken Fyten made changes -
        Fix Version/s 1.8.2-RC1 [ 10210 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P2

          People

          • Assignee:
            Adnan Durrani
            Reporter:
            Jack Van Ooststroom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: