Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

is HFSJ wrong about error pages?

 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I was playing around with exception stuff on my Tomcat 5.5.4 at home, and noticed a couple things that don't make sense and, according to HFSJ shouldn't happen.

1. If I have two error-page elements defined in web.xml, and one's exception-type is an extension/implementation of the other's, the error-page element the broader exception-type <i>always</i> get's used. HFSJ implied that the strictest type that can be applied to a thrown exception is the one that get's called.

2. In an error page, pageContext.getException() only returns the exception for that page if the JSP page that threw the exception referenced the error page with the page directive attribute errorPage. If the JSP page that threw the exception doesn't have this attribute and the error page was only called because of the <error-page> DD element, pageContext.getException() returns null. The implicit exception scripting variable still works, but there doesn't seem to be a way to get to the exception through EL.

Are these bugs with Tomcat 5.5.4 or what?

Thank you,
Yuriy Zilbergleyt
 
PNS Subramanian
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct me if otherwise.

I had two exceptions BusinessException and DomainException with corresponding jsp pages for each of the exception types defined. I do notfind a situation wherein the broader exception type (DomainException) gets called always. All my doGet() method does is to throw either of the two exceptions alternately.

Env:Tomcat 5.0.30/Win XP.
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmm. I had an error-page for a java.lang.Exception, and a java.lang.ArithmeticException. For a div/0, the Exception one was always called. If that error-page element was removed, the ArithmeticException one got called.

-Yuriy
 
Yuriy Zilbergleyt
Ranch Hand
Posts: 429
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just found out that it is a tomcat bug for #2.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic