Bug 37062 - More helpful message when exceptions are raised on JSPs
Summary: More helpful message when exceptions are raised on JSPs
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: Unknown
Hardware: All All
: P2 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL: http://www.tfenne.com/jasper/
Depends on:
Reported: 2005-10-13 03:40 UTC by Tim Fennell
Modified: 2006-04-03 19:11 UTC (History)
0 users

Patch file generated against SVN on October 12th 2005 (8.11 KB, patch)
2005-10-13 03:43 UTC, Tim Fennell
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Fennell 2005-10-13 03:40:28 UTC
The JasperException that is thrown whenever an exception is thrown either directly on a JSP or by code 
invoked directly or indirectly from the JSP only ever contains the line number of the line in the 
generated java servlet file.  This means that developers have to trawl through the Tomcat working 
directory, dig up the generated java file, then compare the generated line against their JSP to figure out 
where the error originated from.

Several other containers, WebLogic and Resin to mention but two, provide more information; crucially 
the line number in the JSP and in WebLogic's case a fragment of the JSP showing the error in context.

I have assembled a patch (which I will attach here) that provides similar functionality in Tomcat.  The 
diff is against SVN as of the date of submitting this bug.  The full modified source files are available for 
download at the URL attached to this bug, should the patch be out of date by the time it is processed.

I find this is a huge productivity booster for me, and my post to the Tomcat user mailing list elicited 
replies asking for the source code *now*.  I hope this can find it's way into the next build(s) of Tomcat.  
I've tested it against 5.5.9 and 5.5.12, but not the 5.0 releases.
Comment 1 Tim Fennell 2005-10-13 03:43:08 UTC
Created attachment 16679 [details]
Patch file generated against SVN on October 12th 2005

Patch contains modifications to ...jasper.compiler.Compiler.java and
Comment 2 Yoav Shapira 2005-10-17 00:08:59 UTC
Tim, this looks like a fantastic enhancement.  Thank you for submitting it and
all the associated information at http://www.tfenne.com/jasper/.  I've committed
it into HEAD, it'll be in 5.5.13.
Comment 3 Remy Maucherat 2005-10-17 01:32:56 UTC
Most people likely use development mode in production. This could lead to memory
trouble :(
Comment 4 Jolly Chen 2006-04-04 02:11:15 UTC
The new line numbering information is helpful but it looks like post 5.5.13,
after this change has gone in, the root cause exception is wrapped in an
additional layer, making it difficult to catch with settings in the web.xml like


That config works in 5.5.12 and earlier, but with 5.5.13+ with development mode,
the exception appears to be wrapped one layer thicker (once in the generated
tags code, and once in the ServletWrapper) so that the error-page behavior breaks.