Uploaded image for project: 'JBoss Web'
  1. JBoss Web
  2. JBWEB-211

Jasper Parser drops exception root cause

    Details

    • Steps to Reproduce:
      Hide

      IN our case, we're having trouble instantiating a TagExtraInfo class, but without the full exception, we can't be sure why. The way to reproduce this is to declare a custom Tei class that throws an exception in its constructor.

      Show
      IN our case, we're having trouble instantiating a TagExtraInfo class, but without the full exception, we can't be sure why. The way to reproduce this is to declare a custom Tei class that throws an exception in its constructor.

      Description

      Line 342 in of java/org/apache/jasper/compiler/Parser.java (see below) commits one of the cardinal sins of exception handling - it drops the original stack trace, and original root causes.

      This has contributed to the premature grey hair of one of our sysadmins, as he tries to sort out why a particular tag is causing the JSP compiler to puke.

      327
      328 /*
      329 * Invokes parserController to parse the included page
      330 */
      331 private void processIncludeDirective(String file, Node parent)
      332 throws JasperException {
      333 if (file == null)

      { 334 return; 335 }

      336
      337 try

      { 338 parserController.parse(file, parent, jarFileUrl); 339 }

      catch (FileNotFoundException ex)

      { 340 err.jspError(start, "jsp.error.file.not.found", file); 341 }

      catch (Exception ex)

      { 342 err.jspError(start, ex.getMessage()); 343 }

      344 }
      345

      It looks like there is a bit of work involved to craft a better response, perhaps adding another jspError variant - but surely the actual exception is important enough to go through the effort.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                rmaucher Remy Maucherat
                Reporter:
                asacamano Andrew Sacamano
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: