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=13062>. 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=13062 removeChild failes when a NPE when a NodeIterator is attached ------- Additional Comments From [EMAIL PROTECTED] 2002-10-08 16:45 ------- The problem arises when any NodeIterator has not been detatches after its use or has never been called and you want to remove a node from the tree. At removal of a node, the node will first be removed from all iterators. If however the iterator has reached it's end "fCurrentNode=null" (and not been detached). This gife rise to a NullPointerException in the method matchNodeOrParent (in the second pass through the for loop when executing n.getParentNode() ) current: Node matchNodeOrParent(Node node) { for (Node n = fCurrentNode; n != fRoot; n = n.getParentNode()) { if (node == n) return n; } return null; } possible fix: Node matchNodeOrParent(Node node) { if (fCurrentNode == null) return null; for (Node n = fCurrentNode; n != fRoot; n = n.getParentNode()) { if (node == n) return n; } return null; } I found this problem when trying out Xerces_2.2.0 on code previously running under Xerces_1.4.4. I use NodeIterators extensivly and have failed to call the detach() method. Then i try to the method "node.insertBefore(newNode, refNode)" This will eventually take me to matchNodeOrParent and the NullPointerException I beleve a NullPointerException is a bug in this situation. One could argue that the wrong use of NodeIterator is to blame, if so I would prefere an exception that told me so. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
