harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Gray <chris.g...@kiffer.be>
Subject Re: [classlib] Exception throwing compatibility: java.util.Scanner
Date Thu, 06 Jul 2006 18:53:02 GMT
On Thursday 06 July 2006 16:49, Geir Magnusson Jr wrote:
> This is a great example.  The last two aren't even legal exceptions for
> that method.
> It seems like the RI is doing random crap, and it wouldn't be something
> that someone would depend on... can you imagine?

I think we have to distinguish between exceptions like these, which normally 
nobody ever sees, unless they are actually writing tests for the core APIs 
(or unless they make a major programming blunder - and then they'll fix that 
and forget precisely what exception was thrown) on the one hand, and 
exceptions which one can reasonably expect to happen sometimes when 
developing code which may run in a variety of Java environments. An example 
of the latter would be ClassNotFoundException indicating that the runtime 
environment does not contain some wished-for class or package; if the 
application programmer builds in a throw..catch clause which implements a 
fallback, then you'd better theow ClassNotFoundException and not some random 
thing like NoClassDefFoundError or NPE. Similarly, I just heard from a 
customer that some application was failing because we were throwing 
LinkageError when a shared library could not be found, whereas the 
application only had a handler for UnsatisfiedLinkError. In this case both 
the RI and the spec were in agreement, but I would happily have made the 
change even if the spec had specified LinkageError and the RI was throwing 
the subclass UnsatisfiedLinkError. 

Fcourse it's not always easy to draw the line between exceptions which 
probably represent a programmer error and those which robust programs may 
need to handle, hance there will always be a need to discuss some of these 

Chris Gray        /k/ Embedded Java Solutions      BE0503765045
Embedded & Mobile Java, OSGi    http://www.k-embedded-java.com/
chris.gray@kiffer.be                             +32 3 216 0369

Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org

View raw message