ICEfaces
  1. ICEfaces
  2. ICE-9784

NullPointerException thrown in DOMResponseWriter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-3.3.0.GA_P01
    • Fix Version/s: 4.0.BETA, EE-3.3.0.GA_P02, 4.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
       ICEfaces-EE-3.3.0.GA_P01-tableConfigEnh-Build-120913
    • Assignee Priority:
      P1
    • Salesforce Case Reference:

      Description

      The following NPE is thrown with a customers app:

      SEVERE: Error Rendering View[/xhtml/home.xhtml]
      java.lang.NullPointerException
      at org.icefaces.impl.context.DOMResponseWriter.logAllUnclosedNodes(DOMResponseWriter.java:314)
      at org.icefaces.impl.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:230)
      at org.icefaces.impl.context.DOMPartialViewContext.processPartial(DOMPartialViewContext.java:168)
      at javax.faces.component.UIViewRoot.encodeChildren(UIViewRoot.java:981)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)
      at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:391)
      at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
      at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.wgp.servdev.common.servlet.filter.JSFResourceCacheSettingFilter.doFilter(JSFResourceCacheSettingFilter.java:113)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.wgp.cafe.http.HttpSessionLockFilter.doFilter(HttpSessionLockFilter.java:58)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
      at java.lang.Thread.run(Thread.java:662)

        Activity

        Hide
        Arran Mccullough added a comment -

        Attached customer supplied page code and logs

        Show
        Arran Mccullough added a comment - Attached customer supplied page code and logs
        Hide
        Ted Goddard added a comment -

        There appears to be a possible failure condition where partial rendering seekSubtree with an invalid component ID will result in a null cursor.

        if (log.isLoggable(Level.FINE))

        { log.log(Level.FINE, "unable to seek to component DOM subtree " + id); }

        For the immediate problem, the logging issue can be resolved with a null check.

        Show
        Ted Goddard added a comment - There appears to be a possible failure condition where partial rendering seekSubtree with an invalid component ID will result in a null cursor. if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "unable to seek to component DOM subtree " + id); } For the immediate problem, the logging issue can be resolved with a null check.
        Hide
        Ted Goddard added a comment -

        Related to ICE-9763

        Show
        Ted Goddard added a comment - Related to ICE-9763
        Hide
        Arran Mccullough added a comment -

        Williams is still reporting this issue with the recent patched build. They had provided some details as to where the NPE might me coming from:

        The NPE is coming from a call on DomResponseWriter to com.sun.org.apache.xerces.internal.domNodeImpl which has the following comment.

        /**

        • Return the collection of attributes associated with this node,
        • or null if none. At this writing, Element is the only type of node
        • which will ever have attributes.
          *
        • @see ElementImpl
          */
          public NamedNodeMap getAttributes() { return null; // overridden in ElementImpl }

        I have set the debug level as Ken suggested. But due to the code to log the error is after NPE, it never gets logged in my log file in DOMResponseWriter. I'm getting a lot of error running on Development stage.
        private void logUnclosedNode(Node node) {
        if (node == null) return;
        StringBuilder path = new StringBuilder();
        Node tempCursor = node;
        while (tempCursor != null) {
        if (tempCursor != node)

        { path.insert(0, " -> "); }

        path.insert(0, tempCursor.getNodeName());
        tempCursor = tempCursor.getParentNode();
        }
        Node idNode = node.getAttributes().getNamedItem("id");
        log.log(Level.WARNING, "Missing end-element for: "
        + node.getNodeName() + (idNode == null ? "" : "["+idNode.toString()+"]")
        + " (path: " + path + ")");
        }

        Show
        Arran Mccullough added a comment - Williams is still reporting this issue with the recent patched build. They had provided some details as to where the NPE might me coming from: The NPE is coming from a call on DomResponseWriter to com.sun.org.apache.xerces.internal.domNodeImpl which has the following comment. /** Return the collection of attributes associated with this node, or null if none. At this writing, Element is the only type of node which will ever have attributes. * @see ElementImpl */ public NamedNodeMap getAttributes() { return null; // overridden in ElementImpl } I have set the debug level as Ken suggested. But due to the code to log the error is after NPE, it never gets logged in my log file in DOMResponseWriter. I'm getting a lot of error running on Development stage. private void logUnclosedNode(Node node) { if (node == null) return; StringBuilder path = new StringBuilder(); Node tempCursor = node; while (tempCursor != null) { if (tempCursor != node) { path.insert(0, " -> "); } path.insert(0, tempCursor.getNodeName()); tempCursor = tempCursor.getParentNode(); } Node idNode = node.getAttributes().getNamedItem("id"); log.log(Level.WARNING, "Missing end-element for: " + node.getNodeName() + (idNode == null ? "" : " ["+idNode.toString()+"] ") + " (path: " + path + ")"); }
        Hide
        Ted Goddard added a comment -

        Do they have a stack trace from the current code?

        Show
        Ted Goddard added a comment - Do they have a stack trace from the current code?
        Hide
        Ted Goddard added a comment -

        Current code in ICEfaces 4 trunk is:

        Node idNode = node.hasAttributes() ? node.getAttributes().getNamedItem("id") : null;

        I recommend applying this change to the Williams branch and retesting.

        (The node is not null, but apparently its collection of attributes is null.)

        Show
        Ted Goddard added a comment - Current code in ICEfaces 4 trunk is: Node idNode = node.hasAttributes() ? node.getAttributes().getNamedItem("id") : null; I recommend applying this change to the Williams branch and retesting. (The node is not null, but apparently its collection of attributes is null.)
        Hide
        Ken Fyten added a comment -

        Resolved, Arran are you able to modify the Williams branch with the code change described by Ted?

        Show
        Ken Fyten added a comment - Resolved, Arran are you able to modify the Williams branch with the code change described by Ted?

          People

          • Assignee:
            Arran Mccullough
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: