[jdom-interest] Bug Find (Beta 8) -- Element.java with Seriliazation/Deserialization
Jeremy Prellwitz
jeremy at prellwitz.com
Tue Mar 4 18:08:21 PST 2003
This seems to be a bug, anyways......i can't imagine that it
is a supposed to act this way. This is my first bug report,
hopefully i can continue to contribute more.....
The following is a java program that exposes the bug....if i
run this with the beta7 jar it works fine, if i run this with
the beta8 jar, the bug is exposed. This took me a small while
to debug, as if i printed the contents of the serialized
object using the XMLOutputter ..... everything was
there.....the Element.getChildText(".....") method also works
fine....., but the getChildren(....) methods do not.
Also.....is this mailing list the proper place to report a
bug? If not, let me know, and i'll report it elsewhere.
Thanks.
Jeremy
import org.jdom.Element;
import java.io.*;
import java.util.*;
public class test {
/**
* Class to expose bug??? in jdom beta8 Element object.
*/
public void test7() throws Exception {
Element e = new Element("Main-Tag");
Element e1 = new Element("Child-Tag1");
Element e2 = new Element("Child-Tag2");
Element e3 = new Element("Child-Tag3");
e.addContent(e1);
e.addContent(e2);
e.addContent(e3);
// Outputs 3
System.out.println(e.getChildren().size());
FileOutputStream os = new FileOutputStream("a.tmp");
ObjectOutputStream op = new ObjectOutputStream(os);
op.writeObject(e);
op.flush();
os.close();
FileInputStream is = new FileInputStream("a.tmp");
ObjectInputStream ip = new ObjectInputStream(is);
e = (Element) ip.readObject();
is.close();
// Outputs 0 -- I assume this is a bug.
System.out.println(e.getChildren().size());
}
/**
* Command Line Executable Method
*/
public static void main(String[] args) throws Exception {
test t = new test();
t.test7();
}
}
===================================
Experience is something you don't
get until just after you need it.
===================================
More information about the jdom-interest
mailing list