[jdom-commits] CVS update: jdom/src/java/org/jdom
jhunter at cvs.jdom.org
jhunter at cvs.jdom.org
Thu Jun 21 22:46:01 PDT 2001
Date: Friday June 22, 2001 @ 6:46
Author: jhunter
Update of /home/cvspublic/jdom/src/java/org/jdom
In directory www.nmemonix.com:/tmp/cvs-serv14313
Modified Files:
PartialList.java
Log Message:
Integrated patch to make PartialList.addAll() work OK if the backing list
is non-empty while the PartialList is empty. The patch is from
Mika Haapakorpi <mika.haapakorpi at sensor-sc.fi>. From his email:
The following piece of code throws a java.util.NoSuchElementException
Element e = new Element("koe");
List v = new Vector();
v.add(new Element("koe1"));
v.add(new Element("koe2"));
e.getChildren().addAll(v);
List v2 = new Vector();
v2.add(new Element("koe1"));
v2.add(new Element("koe2"));
e.getChildren("koe").addAll(v2); <- exception thrown from this line:
stacktrace:
Exception in thread "main" java.util.NoSuchElementException
at java.util.LinkedList.getLast(LinkedList.java:109)
at org.jdom.PartialList.addAll(PartialList.java:248)
at SAXBuilderDemo.main(SAXBuilderDemo.java:215)
...
Now i'm using this:
public boolean addAll(Collection c) {
Iterator i = c.iterator();
boolean value = true;
while(i.hasNext() && value ) value = this.add(i.next());
return value;
}
This fix seems to work but of course all the elements are always added
to the end of the entire content of e not after the last element in
PartialList...
---
PartialList is still destined for removal, but if there's a good patch
might as well integrate it. :-)
-jh-
===================================================================
File: no file PartialList.java Status: Needs Checkout
Working revision: 1.13 Fri Jun 22 05:46:00 2001
Repository revision: 1.13 /home/cvspublic/jdom/src/java/org/jdom/PartialList.java,v
Existing Tags:
start (revision: 1.1.1.1)
jdom (branch: 1.1.1)
More information about the jdom-commits
mailing list