[jdom-interest] IOException

Mike Brenner mikeb at mitre.org
Fri Apr 18 05:26:59 PDT 2003


Phil's points below about safer exception handling seem valid (and 
combined with his having production customers already in the field).

I have production code in many places, but all on servers under
my control, so changing back and forth takes just a few lines in each 
product. Unfortunately, Java does not seem to support both b8 and
b9-rc1 compatible code simultaneously, because the exceptions contradict 
each other.

I personally slightly favor a single exception instead of also having
to catch IOException, but that is dwarfed by the need to make the decision 
and then stablize b9. 

B8 is usable for my purposes except for the speed problem,
and the great memory leakage. Therefore, I think there is no 
need to hurry a "1.0" release, but there is a GREAT hurry to 
stablize b9, which solves these two important issues.

The outstanding requests about making certain things visible and
changing certain features should be dealt with as quickly as 
possible and then b9 should be declared.

Mike Brenner


> >>>I think it's OK for JDOM to depend on standard Java libraries such as
> java.io. In fact, it really couldn't be otherwise since we accept
> java.io.InputStreams and java.io.Readers as method arguments. It just
> makes sense to throw an IOException for an I/O error.<<<

phil at triloggroup.com wrote:
> From a pure design perspective, I disagree with that because it really violates the database isolation principle.
> A good example from Sun is JDBC, where only SQLException is send, while it uses IOStream. It never throws neither
> java.io.IOException, nor java.net.* exceptions.
> When catching that exception, do you really care about the IOException? I don't think so, you just want to recover from
> the error. And, even in case you need it, you're still able to query the embbeded exception (getCause()).
> 
> From a user perspective, declaring multiple exceptions that do not inherit from a common base (other that exception)
> often lead to code like:
>      try {
>      } catch( Exception e ) {
>          //....
>      }
> which catches all exceptions, including RuntimeException! This is definitively worse




More information about the jdom-interest mailing list