This week's book giveaway is in the Testing forum. We're giving away four copies of The Way of the Web Tester: A Beginner's Guide to Automating Tests and have Jonathan Rasmusson on-line! See this thread for details.
Earlier this week, I began my journey into JSP/JSF. So far, it's feeling a lot like PHP, but I'm told that'll change. :)
I noticed something odd today about <error-page> tag handling. I'm causing a NPE in my jsp with the following:
In my web.xml, if I only have an <error-page> tag that handles RuntimeException, then the runtime.jsp is used (as expected). If I add a handler for NullPointerException, that is used (as expected). However, if I replace the NullPointerException handler with an Exception handler (the base of RuntimeException), the RuntimeException handler is skipped in favour of the Exception handler:
This seems odd to me, because RuntimeException is derived from Exception. The runtime.jsp simply does (html removed for brevity):
I tried with a few other RTEs (such as ArrayIndexOutOfBoundsException). Same thing happened - the RuntimeException handler is skipped in favour of the Exception handler. If I replace the Exception handler with a Throwable handler (now the web.xml only has RuntimeException and Throwable <error-page> tags), the Throwable handler is called - again, skipping the RuntimeException handler.
Is there a reason for this behaviour? Should not the RuntimeException handler be used when it's the derived of Exception and Throwable, like it would in a traditional try...catch: