[jdom-commits] CVS Update: jdom/src/java/org/jdom

nobody nobody at chimbo.servlets.com
Mon May 5 00:04:10 PDT 2003


****************************************
Date:   Mon May  5, 2003 @01:04:10 MDT
Author: 

Update of /home/cvs/jdom/src/java/org/jdom
In directory chimbo:/tmp/cvs-serv7549

Modified Files:
DataConversionException.java
Log Message:
Cleaning up the DataConversionException javadocs per Rusty's mail.
I'll keep DCE for now since it's checked and makes more sense for
boolean values.

-jh-

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

Last May, Jason objected that NumberFormatException was inappropriate
for getBooleanValue. There's no BooleanFormatException. The
java.lang.Boolean class interprets all non-true strings as false. I
don't think we should go that far, but even if we keep
DataConversionException the JavaDoc needs to be fixed.
--


===================================================================
File: no file DataConversionException.java		Status: Needs Checkout

   Working revision:	1.12	Mon May  5 07:04:10 2003
   Repository revision:	1.12	/home/cvs/jdom/src/java/org/jdom/DataConversionException.java,v

   Existing Tags:
	jdom_1_0_b9              	(revision: 1.10)
	jdom_1_0_b8              	(revision: 1.7)
	jdom_prefilter           	(revision: 1.5)
	jdom_1_0_b7              	(revision: 1.5)
	jdom_1_0_b6              	(revision: 1.2)
	start                    	(revision: 1.1.1.1)
	jdom                     	(branch: 1.1.1)




More information about the jdom-commits mailing list