[jdom-interest] DataConversionException javadoc and other issues

Elliotte Rusty Harold elharo at metalab.unc.edu
Tue May 14 08:01:20 PDT 2002


The Javadoc for the DataConversionException constructor (see 
http://www.jdom.org/docs/apidocs/org/jdom/DataConversionException.html) 
is very misleading. It has nothing to do with missing attributes, and 
everything to do with a string not being able to be converted to a number.

I was just going to submit a patch, but then I began to wonder whther we 
still needed this exception class at all. It is only thrown, as near as 
I can see, by four methods in Attribute: getIntValue(), getFloatValue(), 
getDoubleValue(), getLongValue. If getIntValue() or getFloatValue(), 
etc. fail the natural response is a NumberFormatException. Would it be 
better to throw that and delete DataConversionException completely?

The big difference is that DataConversionException is checked and 
NumberFormatException is not. I think that this case  does satisfy the 
criterion for checked excepitons that, (following Bloch) " the 
exceptional condition cannot be prevented by proper use of the API /and/ 
the programmer using the API can take some useful action once confronted 
with the exception"

Thoughts?

-- 
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+ 
|           The XML Bible, 2nd Edition (IDG Books, 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