Chris Gray wrote:
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 cases.

Thanks a lot, Chris.

We may frequently encounter this confused situation, and I suggest we discuss the problems case by case if someone is not sure how to do. ;-)

For this case, I decide to follow "useRadix(int radix)". Please correct me if I'm wrong. Thanks a lot.

Best regards,
Richard
Chris
ยต

--
Richard Liang
China Software Development Lab, IBM

Reply via email to