xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Wolfgang Hoschek <whoschek AT lbl.gov>
- To: "Bradley S. Huffman" <hip AT a.cs.okstate.edu>
- Cc: Elliotte Harold <elharo AT metalab.unc.edu>, xom-interest AT lists.ibiblio.org
- Subject: Re: [XOM-interest] nodes.insert(null)
- Date: Sun, 6 Feb 2005 09:18:13 -0800
I'm for throwing an exception, and it won't break any code I'm aware of.
Wolfgang.
On Feb 6, 2005, at 8:05 AM, Bradley S. Huffman wrote:
Elliotte Harold writes:
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?
I view Nodes as a place holder for results, not slots to be filled or left
empty. When nodes.size() > 0, I think the right thing is to have at least
one actual Node. Throw the exception.
Brad
_______________________________________________
XOM-interest mailing list
XOM-interest AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/xom-interest
-
[XOM-interest] nodes.insert(null),
Elliotte Harold, 02/06/2005
-
Re: [XOM-interest] nodes.insert(null),
Bradley S. Huffman, 02/06/2005
- Re: [XOM-interest] nodes.insert(null), Wolfgang Hoschek, 02/06/2005
-
Re: [XOM-interest] nodes.insert(null),
Bradley S. Huffman, 02/06/2005
Archive powered by MHonArc 2.6.24.