1. Set up an application with an Ant script to compile JSPs as recommended at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jasper-howto.html 2. Write a JSP which contains erroneous text such that the first phase (JSP -> Java translation) fails e.g. by including <jsp:include x="50"/> in the page. 3. Compile the application using the Ant script - a Jasper exception will be reported. This will be reported including the whole Jasper stack trace, which makes the report unreadable. Just the error message with the location would be sufficient.
Print rootcause's stack trace only if rootcause is different from JasperException
Thanks, this is definitely an improvement. For IDE usage, it would be useful to do some additional changes to the build error format: Not including a link to line number in build.xml, as that is not too significant to the developet. Instead, including the full path of the JSP which contains the error. Also, text "org.apache.jasper.JasperException" is unnecessary. So instead of: E:\bugs\28603_tomcat\project\build.xml:23: org.apache.jasper.JasperException: /JSP.jsp(6,0) Include action: Mandatory attribute page missing the output would look like: E:\bugs\28603_tomcat\project\web\JSP.jsp [6:0] Include action: Mandatory attribute page missing This would make the error format consistent with Javac. Is this possible? Thanks.
- Include full path of the JSP that contains the error: Done! - Avoid including a link to line number in build.xml: 'ant' is adding the build.xml line number when catching the exception thrown by JspC.execute(). I don't think there is anything we can do to avoid this. - Text "org.apache.jasper.JasperException" is unnecessary: The exception class name is printed by JasperException.toString(), which is inherited from java.lang.Throwable.toString(): public String toString() { String s = getClass().getName(); String message = getLocalizedMessage(); return (message != null) ? (s + ": " + message) : s; } We could override JasperException.toString() to suppress the exception class name and just output the exception message. I agree the exception class name is redundant when using JspC, but it is useful info when compiling via the JspServlet. Won't be changed. :)
Ok, this is a sufficient solution for our purposes. Thanks a lot!