• Post Reply Bookmark Topic Watch Topic
  • New Topic

error-page tag handler sequence in web.xml  RSS feed

 
Chris Barrett
Bartender
Posts: 321
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

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:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!