[jdom-interest] bug in Element?

Nick Wormley nickw at tera.teralink.com
Wed Jun 6 17:06:18 PDT 2001

Hello -- 

Using the latest revision of Element.java (1.79), 
I get the following stack trace:

Exception in thread "main" java.lang.NullPointerException
        at org.jdom.Element.setMixedContent(Compiled Code)
        at org.jdom.Element.setChildren(Element.java:1009)
        at Test.main(Test.java:14)

by runnning this code:

import java.util.*;
import org.jdom.Element;

public class Test {

    static public void main( String[] args ) {
	List list = new ArrayList();
	list.add( new Element( "foo" ) );
	new Element( "bar" ).setChildren( list );

It looks like there should be a null check on oldContent at 
line 919, since it is possible that the Element had no 
content prior to the setChildren call.


Nick Wormley
Nistevo Corporation
nwormley at nistevo.com

More information about the jdom-interest mailing list