Bug 28604 - JspC should not display the whole stack trace of errors
Summary: JspC should not display the whole stack trace of errors
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.19
Hardware: All All
: P3 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2004-04-26 17:32 UTC by Petr Jiricka
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Petr Jiricka 2004-04-26 17:32:50 UTC
1. Set up an application with an Ant script to compile JSPs as recommended at
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
Comment 1 Jan Luehe 2004-04-28 00:43:00 UTC
Print rootcause's stack trace only if rootcause is different from
Comment 2 Petr Jiricka 2004-05-06 15:25:57 UTC
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.
Comment 3 Jan Luehe 2004-05-12 22:59:34 UTC
- Include full path of the JSP that contains the error:


- 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. :)
Comment 4 Petr Jiricka 2004-05-13 08:36:34 UTC
Ok, this is a sufficient solution for our purposes. Thanks a lot!