[jdom-interest] DataConversionException javadoc and other issues

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu May 16 20:18:01 PDT 2002


At 2:49 PM -0700 5/16/02, Jason Hunter wrote:
>Hmm, you seem to be arguing both sides here.
>

Often. How else would I figure out which one is right? Seriously, I'm 
not sure what to do here. Of course my real preference is to 
eliminate these five methods completely, but that's been rejected in 
the past.

>I think the reason we have DCE is because att.getBooleanValue() doesn't
>make much sense to throw an NFE.

I missed that originally. However, I did notice it later and looked 
at what Boolean.valueOf() does. Turns out it defines true and false 
very differently from how we do. In particular, it sees "true" in all 
combinations of case as true, and all other strings including "yes", 
"no", "False", "1", "0", "Lois", and more as false. It never throws 
an exception. If we adopted that behavior (which is not the same as 
the schema behavior or the current JDOM behavior) then this method 
wouldn't have to throw an exception.

An alternative position is that since many different applications 
recognize different, mutually incompatible lexical representations of 
booleans we really shouldn't be trying to pick one with a 
getBooleanValue() method at all. Even if we have 
getInt/Long/Float/DoubleValue(), getBooleanValue() is in practice a 
lot trickier.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|             http://www.cafeconleche.org/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list