Details
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?
if (cursor == null) {
cursor = document.getDocumentElement();
+ if (cursor == null) {
+ cursor = document;
+ }
}
This may be naively missing something; WDYT?
Issue Links
- depends on
-
ICE-5868 MyFaces 2 compatibility
- Closed
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!