[jdom-interest] [Vote] NoSuchChildException

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Jul 13 05:05:22 PDT 2000


At 12:13 AM -0700 7/13/00, Alex Chaffee wrote:

>Element is a collection.  If a collection has no such element it
>returns null.  QED.
>

Your second premise is flawed, therefore the syllogism fails. The 
Java Collections API is extremely schizophrenic on what to do when no 
such element exists. Some methods return null. Some methods throw a 
NoSuchElementException. Some methods throw an 
IndexOutOfBoundsException.

In fact we originally went to throwing an exception by analogy with 
the Collections API, and I'm certain we changed 
NoSuchElementException to NoSuchChildException precisely to avoid the 
name conflict with java.util.NoSuchElementException.

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list