DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=33963>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=33963 Summary: NullPointerException when calling DomStreamer.stream() on a DOM with a text node whose text value is null. Product: Cocoon 2 Version: 2.1.6 Platform: PC OS/Version: Windows 2000 Status: NEW Severity: minor Priority: P2 Component: general components AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] Hi, I'm getting a NullPointerException when streaming a DOM using org.apache.cocoon.xml.dom.DOMStreamer.strem(Document) when the DOM contains a text node with a text value set to null. This doesn't cause problems with the Serialization routines in the DOM. This is the problem method: private final void dispatchChars(Node node) throws SAXException { String data = ((Text) node).getData(); contentHandler.characters(data.toCharArray(), 0, data.length()); } Here are to obvious possible fixes. I'm not familiar enough with the rules of SAX to know which one is more correct. private final void dispatchChars(Node node) throws SAXException { String data = ((Text) node).getData(); if(null == data){ data = ""; } contentHandler.characters(data.toCharArray(), 0, data.length()); } private final void dispatchChars(Node node) throws SAXException { String data = ((Text) node).getData(); if(null != data){ contentHandler.characters(data.toCharArray(), 0, data.length()); } } The following is the relevant chunck of the stack trace. java.lang.NullPointerException at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.dispatchCh ars(DOMStreamer.java:264) at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.startNode (DOMStreamer.java:471) at org.apache.cocoon.xml.dom.DOMStreamer$NamespaceNormalizingDOMStreamer.stream (DOMStreamer.java:229) at org.apache.cocoon.xml.dom.DOMStreamer.stream(DOMStreamer.java:150) I checked the latest in the SVN tree this morning, and dispatchChars() still looks as it does above. In my case, i can change the DOM generation to work around the problem, but I suspect it could be an issue for other people who can't modifiy the code that is creating the DOM for them. Thanks, John Yonosh -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
