commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11951] New: - null pointer exception in org.apache.commons.jxpath.ri.model.dom.DOMNodePointer when setting a value
Date Thu, 22 Aug 2002 23:35:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11951>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11951

null pointer exception in org.apache.commons.jxpath.ri.model.dom.DOMNodePointer when setting
a value

           Summary: null pointer exception in
                    org.apache.commons.jxpath.ri.model.dom.DOMNodePointer
                    when setting a value
           Product: Commons
           Version: Nightly Builds
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: JXPath
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mark@golden-orb.com


bug in org.apache.commons.jxpath.ri.model.dom.DOMNodePointer

The problem is when you try and set the value of a DOM node that has more
than 1 child text node. the clearing of the nodes is ctashing:

line 366:
int count = children.getLength();
for (int i = 0; i < count; i++){
 Node child = children.item(i);
 if (child.getNodeType() == Node.TEXT_NODE ||
	    child.getNodeType() == Node.CDATA_SECTION_NODE){
	node.removeChild(child);
 }
}
when a node is deleted it is removed from the children list.

fix:
int count = children.getLength();
int nPos=0; 
for (int i = 0; i < count; i++){
 Node child = children.item(nPos);
 if (child.getNodeType() == Node.TEXT_NODE ||
	    child.getNodeType() == Node.CDATA_SECTION_NODE){
	node.removeChild(child);
 } else {
	 nPos++;//only increment position if we are not deleting it
 }
}


This is in both stable and nightly builds

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message