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=27687>.
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=27687

NodeList not thread safe

           Summary: NodeList not thread safe
           Product: Xerces-J
           Version: 1.2.3
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


The NodeList implementation is not thread safe. When iterating through children 
of a particular node, the NodeList gets changed by another thread doing the 
same action. As a result I get a NullPointerException sometimes and some other 
times I get "wrong document error" when I try to append this clone a child node 
to a document.

The first implementation to access children of a node does not work.

    NodeList childList=root.getChildNodes();
    for (int i=0; i<childList.getLength(); i++)
    {
        // doing something here with "childList.item(i)"
    }
        

The second implementation to access children of a node works.

        Node currChildNode = root.getFirstChild();
        while(currChildNode != null)
        {
                // Do something here with the "currChildNode"
                currChildNode = currChildNode.getNextSibling();
        }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to