Merrill Cornish [mailto:[EMAIL PROTECTED] wrote...
> Why did main servlet processing appear to continue (allowing the
> second sendRedirect() to cause a problem) after the exception was
> triggered?
Processing of a catch block does not terminate processing of the surrounding method.
In other words, in this code fragment
try {
foo.callMethodThrowingFooException();
}
catch (FooException fe) {
System.out.println("Caught a FooException");
}
System.out.println("After try/catch block");
if a FooException if thrown, control flows to the catch block, but then drops out to
the following code normally. This is a useful Java language feature for dealing with
locally-recoverable errors.
If you want method processing to stop, you have to throw a new exception, return from
inside the catch block, add logic suppressing further processing triggered by a flag
set in the catch block, or otherwise explicitly avoid executing the remainder of the
method.