Bug 27687 - NodeList not thread safe
Summary: NodeList not thread safe
Status: NEW
Alias: None
Product: Xerces-J
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.2.3
Hardware: Sun Solaris
: P3 critical
Target Milestone: ---
Assignee: Xerces-J Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-16 00:58 UTC by Paul Henry
Modified: 2004-11-16 19:05 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Henry 2004-03-16 00:58:58 UTC
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();
        }