ICEfaces
  1. ICEfaces
  2. ICE-6864

MyFaces' state writing triggers NPE in DOMResponseWriter

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.1-Beta, 3.0
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      MyFaces 2.1.0-SNAPSHOT on Tomcat7
    • Assignee Priority:
      P3

      Description

      MyFaces calls #cloneWithWriter using its StateWriter, which goes through some acrobatics, the upshot of which is that DOMResponseWriter#startElement is called sometime after DOMResponseWriter#endDocument. #startElement appropriately creates a new Document if its document reference is null, then calls #appendToCursor which, finding that the cursor instance variable is null, assigns that to document.getDocumentElement(). Unfortunately the Document, having just been instantiated, has no document element. What seems like the obvious way to address this issue is to re-check the cursor, i.e.:

                   if (cursor == null) {
                       cursor = document.getDocumentElement();
      + if (cursor == null) {
      + cursor = document;
      + }
                   }

      This may be naively missing something; WDYT?

        Issue Links

          Activity

          Hide
          Matt Benson added a comment -

          The attached archive contains a Maven-based project that wherein the described NPE is exhibited. Note that I have the Apache snapshot repo enabled in my local Maven settings:

          <profile>
          <id>apache-snapshots</id>
          <repositories>
          <repository>
          <id>apache-snapshots</id>
          <name>Apache Snapshot Repository</name>
          <url>https://repository.apache.org/content/groups/snapshots-group/</url>
          <releases>
          <enabled>false</enabled>
          </releases>
          <snapshots>
          <enabled>true</enabled>
          </snapshots>
          </repository>
          </repositories>
          </profile>

          </profiles>

          <activeProfiles>
          <activeProfile>apache-snapshots</activeProfile>
          </activeProfiles>

          Thanks!

          Show
          Matt Benson added a comment - The attached archive contains a Maven-based project that wherein the described NPE is exhibited. Note that I have the Apache snapshot repo enabled in my local Maven settings: <profile> <id>apache-snapshots</id> <repositories> <repository> <id>apache-snapshots</id> <name>Apache Snapshot Repository</name> <url> https://repository.apache.org/content/groups/snapshots-group/ </url> <releases> <enabled>false</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> </profile> </profiles> <activeProfiles> <activeProfile>apache-snapshots</activeProfile> </activeProfiles> Thanks!
          Hide
          Matt Benson added a comment -

          Also, I should mention that the bug doesn't trigger right away. I came across it when I went to the index.jsf page of the app, then clicked the "Press Me" button multiple times without doing anything else.

          Show
          Matt Benson added a comment - Also, I should mention that the bug doesn't trigger right away. I came across it when I went to the index.jsf page of the app, then clicked the "Press Me" button multiple times without doing anything else.
          Hide
          Deryk Sinotte added a comment -

          I did see this issue a couple of times but wasn't able to produce it reliably. I've added the additional null check as precaution.

          Show
          Deryk Sinotte added a comment - I did see this issue a couple of times but wasn't able to produce it reliably. I've added the additional null check as precaution.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Matt Benson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: