• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Wrath of incompatible throws clause in SimpleTagSupport.doTag()

 
Jacob Fenwick
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been pressing for increased use of tags, beans, and EL, but I keep running into a problem. There is much weeping and gnashing of teeth whenever someone needs to throw an exception as you need to wrap everything in JspException.
This sort of ruins our whole exception framework, as previously we would throw exceptions up the hierarchy to the JSP, and we could see what kind of errors it was at the top, but since JspException wraps everything now we have to dig down to find the real exception.
Is there a way around this?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64994
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JspException is a wrapper exception in which you record the actual exception as the root cause.

For example, in order to have your cake and eat it too within a method that only allows throwing a JspException:



By supplying the root exception as the 2nd paramter to the JspException constructor, it is propogated and reported as the root cause.

ServletException is another example of a wrapper exception.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic