[jdom-interest] BUG in Document

Frank Morton fmorton at base2inc.com
Mon Feb 12 09:48:00 PST 2001

> Frank Morton wrote:
> > 
> > > > But, you can't do that.
> > >
> > > Why not?
> > >
> > > -jh-
> > 
> > You can. I was just flaking out. 
> Whew.
> > But the bug I originally reported is still there.
> I don't see it as a bug.  If you subclass Document your subclass is
> responsible for managing some of Document's internals.  We
> *intentionally* don't do any work in the protected constructor because
> some subclasses may not want to waste time constructing a list that may
> not be used.  In other words, only a subclass that knows what it's doing
> should call new Document().

I agree with you after looking at it. Just to finish the thread, if
someone subclasses Document, instantiates the Document with
the default constructor, specifically the "content" List will not
have been initialized. So, if someone does this, they need to
instantiate the protected "content" before setting the root element.

Thanks everyone.


More information about the jdom-interest mailing list