if the parameters to the inner log statement fail in some way, the
externally visible behavior could look like only one of the two log
statements executing. For example...
String foo = null;
try {
try {
int x = "something".length() / 2;
}
finally {
System.out.println("the inner value of foo is: " + foo.toString());
}
}
finally {
System.out.println("the outer value of foo is: " + foo);
}
Would only print:
the outer value of foo is: null
The inner statement would not print, instead it would throw a
nullpointerexception.
---- Cris J H
George Lindholm wrote:
Cris J Holdorph wrote:
I can't help with your greater problem but to the smaller one...
The code you included could run the outside finally block only, if the
m_authenticationService.authenticate() method throws an exception. In
this case, the call stack ends abnormally, so it never tries the next
normal line of code that wold begin the inner try block.
I do agree that if you see the 'inner' log/finally block executed you
should see the outer one as well. Unless of course, 'log.info()'
itself blows up, which is possible if you're passing it objects that
are not well behaved.
Hi Chris,
maybe no the best pseudo code.
try {
try {
Authentication.authenticate::securityContext.authenticate();
} finally {
log
}
} finally {
log
}
There should be no way the both log lines are not execute.
No errors in any of the log files.
?
George
---- Cris J H
George Lindholm wrote:
I finally added a bunch if "finally" statements like so:
LoginServlet:
try {
m_authenticationService.authenticate():
try {
securityContext.authenticate();
} finally {
log.info(...);
}
} finally {
log.info(...);
}
The really weird part is that both "finally" blocks are not executed????
How is this possible? I thought the JVM guaranteed that a finally block
will be execute.
Is there anything the Spring framework might be doing to unravel the
call stack??
Thanks
George
--
You are currently subscribed to uportal-dev@lists.ja-sig.org as: [EMAIL
PROTECTED]
To unsubscribe, change settings or access archives, see
http://www.ja-sig.org/wiki/display/JSG/uportal-dev