[jdom-interest] ADDING A CHILD....

Antonello Dell'Armi A.Dellarmi at ELIS.ORG
Thu Dec 12 07:07:25 PST 2002


i have the element instance that have inside the elements watcher.I would like to add a new element watcher with text watcherID.
But the following snipped of code doesn't work correctly. 

List watchers = instance.getChildren("watcher");

Iterator iter = watchers.iterator();

Element newatcher = new Element("watcher");

newatcher.setText(watcherID);

watchers.add(newatcher);
while(iter.hasNext()){

	Element watcher = (Element) iter.next();
	String w = watcher.getText();
	System.out.println("watcher= " + w);
}

I get the error below. Any help?   BRGS antonello

Exception in thread "main" java.util.ConcurrentModificationException
        at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java
48)
        at java.util.LinkedList$ListItr.next(LinkedList.java:484)
        at UPMDataManagerImpl.addWatcher(UPMDataManagerImpl.java:475)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImp
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcc
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)



More information about the jdom-interest mailing list