[jdom-interest] BUG in Document

Kesav Kumar kesavk at voquette.com
Fri Feb 9 10:14:24 PST 2001


How could you compile Document doc = new Document().  the default
constructor is protected you can never instantiate Document object by
calling the default constructor.  You need to pass root Element for creating
Document object.  

Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com
http://www.voquette.com


-----Original Message-----
From: Frank Morton [mailto:fmorton at base2inc.com]
Sent: Friday, February 09, 2001 8:56 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] BUG in Document


I'm a newbie (today), but really like what I see so far and will
be happy to contribute significantly. I'm using code freshly 
checked out of CVS.

If you do:

Document doc = new Document();
doc.setRootElement(new Element("something"));

You get a NullPointerException because "content" is
not initialized when using the no arg constructor.

So, I added the following to the first line of setRootElement(element):

if(content == null) content = new LinkedList();

Since I'm new to the code, don't know if this is the best way to 
do this. So, what is the process of bug fixing?

Just to head this off, I need to be able to do it this way because
I'm writing a class that extends Document, so it needs to construct
the Document before it has a chance to create what is going to
be the root element.

Frank


_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list