Re: Exception handling



Sharp Tool wrote:
>[Malte wrote:]

try { // whatever // do something 2 } catch (ArrayIndexOutOfBoundsException e) { // deal with it, ie do something 1 }

Like i said I don't want to deal with the exception in the catch claus. Doing so, will not return me to where I left off.

You want the exception to still be thrown?

try {
    // whatever
    // do something 2
} catch (ArrayIndexOutOfBoundsException exc) {
    // do something 1
    throw exc;
}

However, you should rarely need to catch runtime exceptions. Much better to ensure what you are doing is valid before.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
.