[jdom-interest] getMandatory*

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Jul 19 07:01:55 PDT 2000


At 11:43 AM +0200 7/18/00, Andre Van Delft wrote:
>Jason Hunter wrote:
>
>> Being that we had an overwhelming set of +1 votes for "null" including
>> the binding votes of Brett and myself (so glad we agree), I've now made
>> the change in the tree.  I changed getChild(), getAttribute(),
>> getRootElement(), and getProcessingInstruction() to return null if no
>> such item was found.  I also removed NoSuch* classes from the tree.  I'm
>> -1 on adding hasChild() because a null check is sufficient.  No reason
>> to bloat the API.
>
>Reluctantly I start the discussion again.
>

Please let's not go there again. Just last week I watched 30 out of 
40 of this semester's students incorrectly intuit that 
Applet.getParameter() threw an exception rather than returning null 
when the HTML file omitted the parameter. And 5 of the 10 who didn't 
think it threw an exception neglected to check for the possible null 
value despite being explicitly instructed  to check for all plausible 
error conditions and having been shown exactly how to handle this 
specific case in class. So I'm more convinced than ever that throwing 
the exception is the right thing to do.

Nonetheless, I think it's more important to move forward and stick 
with the decision that we've made rather than continually arguing the 
same points.

+-----------------------+------------------------+-------------------+
| 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