> > Hi,
> >
[quoted text clipped - 23 lines]
> // 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.
Sharp Tool
Thomas Hawtin - 30 Oct 2005 12:53 GMT
>[Malte wrote:]
>>
[quoted text clipped - 7 lines]
> 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

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Roedy Green - 30 Oct 2005 19:33 GMT
On Sun, 30 Oct 2005 11:30:09 GMT, "Sharp Tool"
<sharp.tool@bigpond.net.au> wrote, quoted or indirectly quoted someone
who said :
>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.
Exceptions are not like PL/I ON units. You either have to write your
own code to detect the nasty condition, or make the try block so short
you know exactly what he problem is.
Recall you can nest try blocks and rethrow exceptions you are not
prepared to deal with yet.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
andreas kinell - 31 Oct 2005 18:08 GMT
>> > Hi,
>> >
[quoted text clipped - 27 lines]
> 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.
That's what you have the finally clause for.
try {
// code that could throw an exception
} catch (Exception e) {
// deal with the exception
} finally{
// resume execution here in _any_ case (regardless of exception thrown
or not
}
andreas
Sharp Tool - 01 Nov 2005 09:33 GMT
> >> > Hi,
> >> >
[quoted text clipped - 40 lines]
>
> andreas
Sure. I think the take home message here is that you cannot test directly if
an exception will be thrown. Rather you should test indirectly if an
exception will not be thrown and if it returns false then you know it will -
if you negate the negation then you back to square one.
Sharp Tool
andreas kinell - 02 Nov 2005 22:24 GMT
>> >> > Hi,
>> >> >
[quoted text clipped - 50 lines]
> will -
> if you negate the negation then you back to square one.
I rather think the take home message is:
you should not try to work around exception handling, because it was written
with the intention to make someone handle it.
On one side we have a good exception concept and on the other side we try to
avoid using it. Doesn't make too much sense.
andreas