Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] nodes.insert(null)

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Harold <elharo AT metalab.unc.edu>
  • To: xom-interest <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] nodes.insert(null)
  • Date: Sun, 06 Feb 2005 10:01:41 -0500

While considering the possibility of allowing Nodes objects to be canonicalized, it occurred to me to wonder whether the items in such a list could be null. Apparently, they can be. This test passes:

public void testNull() {

Nodes nodes = new Nodes();
nodes.append(null);
assertEquals(null, nodes.get(0));

}


I'm not sure I ever really thought about this before. If I had, I think I probably would have decided to throw a NullPointerException when someone tried to insert null into the list, but it's not a strong feeling. Now I'm equally weakly inclined to leave it alone; since it's possible changing this now might break someone's code.

Still, it might be nice to have an absolute guarantee that the items in a Nodes list or never null.

Would anyone care to argue one way or the other? i.e. that Nodes definitely should or definitely should not allow null values?

--
Elliotte Rusty Harold elharo AT metalab.unc.edu
XML in a Nutshell 3rd Edition Just Published!
http://www.cafeconleche.org/books/xian3/
http://www.amazon.com/exec/obidos/ISBN=0596007647/cafeaulaitA/ref=nosim





Archive powered by MHonArc 2.6.24.

Top of Page