please , I want to understande these concept
Although i read about them but i can't understand good.
i want to understand what mean with
1- Rethrowing an Exception .
2-Stack Unwinding .
please illustrate your answer with simple code .
you should to know i'm bignner in java & it is my first time in this site
and i want to make good relation with you .
i wait your answer for my question .
thanks in advance.
beshoy
[441 byte] By [
Beshoya] at [2007-11-27 11:42:10]

(I don't think this is a RTFM question)
So here I give you an example of rethrowing an exception.
Maybe it's a silly one, but usually exceptions do not need to re-thrown.void sendMessage(Message m)
throws SendMessageException
{
try {
Backend.sendMessage(m)
Logger.logGreen("send message succeeded");
} catch (SendMessageException x) {
Logger.logRed("send message failed");
// Here we check the exception only for logging purposes.
// We want the caller to handle the exception, so
// let's re-throw it here:
throw x;
}
}
> (I don't think this is a RTFM question)
>
> So here I give you an example of rethrowing an
> exception.
> Maybe it's a silly one, but usually exceptions do not
> need to re-thrown.
Often, especially in frameworks or between tiers, exceptions are "normalized" so the calling code sees only one type (or a limited number) of exception(s).
tsitha at 2007-7-29 17:42:37 >

> exceptions are "normalized" so the calling code sees
> only one type (or a limited number) of exception(s).
Yes that's very usable. But isn't that, speaking very strictly, called exception wrapping, not exception rethrowing?
I interpreted rethrowing as literally rethrowing the same exception object that you just caught.
> > exceptions are "normalized" so the calling code
> sees
> > only one type (or a limited number) of
> exception(s).
>
> Yes that's very usable. But isn't that, speaking very
> strictly, called exception wrapping, not exception
> rethrowing?
> I interpreted rethrowing as literally rethrowing the
> same exception object that you just caught.
There's a thin line between the two, and it's rather blurred.
Anyway, it's also often a bloody nuisance. Especially when the actual information contained in the original exception is lost and you're left with some generic failure notice that doesn't tell you what failed and why.