Bug #2407
closedDOM wrapper: NPE accessing an empty text node
100%
Description
Reported on saxon-help list.
Caused by: java.lang.NullPointerException: null
at net.sf.saxon.tree.util.FastStringBuffer.append(FastStringBuffer.java:68) ~[Saxon-HE-9.6.0-6.jar:na]
at net.sf.saxon.dom.DOMNodeWrapper.expandStringValue(DOMNodeWrapper.java:337) ~[Saxon-HE-9.6.0-6.jar:na]
at net.sf.saxon.dom.DOMNodeWrapper.getStringValueCS(DOMNodeWrapper.java:283) ~[Saxon-HE-9.6.0-6.jar:na]
at net.sf.saxon.tree.wrapper.AbstractNodeWrapper.atomize(AbstractNodeWrapper.java:104) ~[Saxon-HE-9.6.0-6.jar:na]
Updated by Michael Kay over 9 years ago
Further investigation showed that the DOM contained a text node with a null string value, which was there because it was explicitly put there by an XMLStreamWriter application writing to the DOM.
I'm inclined to do nothing. The DOM doesn't do a very good job of ensuring its own integrity under arbitrary programmatic updates, and we can't be expected to cater for all possible garbage when reading the DOM just because there's nothing that stops the garbage being created.
Updated by Michael Kay over 9 years ago
- Status changed from New to Resolved
I've noticed that on other paths we're careful to check whether node.getNodeValue() returns null, whether or not the documentation says this is possible; so I've added the same check to this path.
Patched on the 9.6 and 9.7 branches.
Updated by O'Neil Delpratt over 9 years ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in version set to 9.6.0.7
Bug fix applied in the Saxon 9.6.0.7 maintenance release.
Updated by O'Neil Delpratt about 9 years ago
- Applies to branch 9.6 added
- Fix Committed on Branch 9.6 added
- Fixed in Maintenance Release 9.6.0.7 added
Please register to edit this issue