ICEfaces
  1. ICEfaces
  2. ICE-1432

D2DFaceletViewHandler throws NPE if not specifying the default jsf suffix

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.6.1
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      any
    • Workaround Exists:
      Yes
    • Workaround Description:
      set the default JSF suffix

      Description

      If you don't set the default JSF suffix in the web.xml and are using Facelets you'll run into this NPE:

      2007-04-16 14:56:34,859 DEBUG [com.sun.faces.lifecycle.RenderResponsePhase] About to render view /main.iface
      2007-04-16 14:56:34,859 ERROR [com.icesoft.faces.facelets.D2DFaceletViewHandler] Problem in renderResponse: replacement
      java.lang.NullPointerException: replacement
      at java.util.regex.Matcher.replaceFirst(Matcher.java:844)
      at java.lang.String.replaceFirst(String.java:1967)
      at com.icesoft.faces.facelets.D2DFaceletViewHandler.getRenderedViewId(D2DFaceletViewHandler.java:232)
      at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:246)
      at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:149)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
      at com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet.service(PersistentFacesServlet.java:402)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      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:96)
      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.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      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.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)

        Issue Links

          Activity

          Philip Breau created issue -
          Hide
          Philip Breau added a comment -

          suggest fix, log error:

          Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java
          ===================================================================
          — D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java (revision 14650)
          +++ D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java (working copy)
          @@ -254,6 +254,12 @@
          String facesSuffix = actionId.substring(actionId.lastIndexOf('.'));
          String viewSuffix = context.getExternalContext()
          .getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME);
          + if( viewSuffix == null ){
          + if (log.isErrorEnabled())

          { + log.error(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME + + " is not initialized in web.xml. Please define the suffix used for your JSF pages. eg. .jspx"); + }

          + }
          viewId = actionId.replaceFirst(facesSuffix, viewSuffix);
          }
          return viewId;

          Show
          Philip Breau added a comment - suggest fix, log error: Index: D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java =================================================================== — D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java (revision 14650) +++ D:/Documents and Settings/pbreau/workspace/ICEfaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java (working copy) @@ -254,6 +254,12 @@ String facesSuffix = actionId.substring(actionId.lastIndexOf('.')); String viewSuffix = context.getExternalContext() .getInitParameter(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME); + if( viewSuffix == null ){ + if (log.isErrorEnabled()) { + log.error(ViewHandler.DEFAULT_SUFFIX_PARAM_NAME + + " is not initialized in web.xml. Please define the suffix used for your JSF pages. eg. .jspx"); + } + } viewId = actionId.replaceFirst(facesSuffix, viewSuffix); } return viewId;
          Philip Breau made changes -
          Field Original Value New Value
          Assignee Mark Collette [ mark.collette ]
          Ken Fyten made changes -
          Fix Version/s 1.6.1 [ 10070 ]
          Assignee Priority P1
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #14695 Tue Aug 21 15:54:43 MDT 2007 mark.collette ICE-1432 : D2DFaceletViewHandler throws NPE if not specifying the default jsf suffix
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java
          Hide
          Mark Collette added a comment -

          Added in the check for the javax.faces.DEFAULT_SUFFIX context parameter, and some nice log error message to explain everything.

          Subversion 14695
          icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java

          Show
          Mark Collette added a comment - Added in the check for the javax.faces.DEFAULT_SUFFIX context parameter, and some nice log error message to explain everything. Subversion 14695 icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java
          Mark Collette made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P1
          Assignee Mark Collette [ mark.collette ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #14853 Mon Sep 24 10:44:49 MDT 2007 mark.collette ICE-1432 : D2DFaceletViewHandler throws NPE if not specifying the default jsf suffix
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #14854 Mon Sep 24 10:52:51 MDT 2007 mark.collette ICE-1432 : D2DFaceletViewHandler throws NPE if not specifying the default jsf suffix
          Files Changed
          Commit graph MODIFY /icefaces/trunk/icefaces/core/src/com/icesoft/faces/facelets/D2DFaceletViewHandler.java
          Hide
          Mark Collette added a comment -

          Had to tweak the fix, because it accidentally used regex search and replace instead of substring search and replace, which means that ".seam" -> ".xhtml" wouldn't change "testseam.seam" to "testseam.xhtml" but would make it "testxhtml.xhtml".

          Subversion 14853
          icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java

          Show
          Mark Collette added a comment - Had to tweak the fix, because it accidentally used regex search and replace instead of substring search and replace, which means that ".seam" -> ".xhtml" wouldn't change "testseam.seam" to "testseam.xhtml" but would make it "testxhtml.xhtml". Subversion 14853 icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java
          Hide
          Mark Collette added a comment -

          Removed some stuff that shouldn't have been included in revision 14853.

          Subversion 14854
          icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java

          Show
          Mark Collette added a comment - Removed some stuff that shouldn't have been included in revision 14853. Subversion 14854 icefaces\core\src\com\icesoft\faces\facelets\D2DFaceletViewHandler.java
          Mark Collette made changes -
          Link This issue blocks ICE-2142 [ ICE-2142 ]
          Hide
          Mark Collette added a comment -

          I spun the last fix commits off into ICE-2142, since it's in a different release then what this first thing was in.

          Show
          Mark Collette added a comment - I spun the last fix commits off into ICE-2142 , since it's in a different release then what this first thing was in.

            People

            • Assignee:
              Unassigned
              Reporter:
              Philip Breau
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: