org.apache.struts2.jasper.compiler

## Class ErrorDispatcher

- java.lang.Object
- - org.apache.struts2.jasper.compiler.ErrorDispatcher

-     public class ErrorDispatcher
      extends Object

  Class responsible for dispatching JSP parse and javac compilation errors to the configured error handler.

  This class is also responsible for localizing any error codes before they are passed on to the configured error handler.

  In the case of a Java compilation error, the compiler error message is parsed into an array of JavacErrorDetail instances, which is passed on to the configured error handler.

  Author:
    Jan Luehe, Kin-man Chung

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ErrorDispatcher(boolean jspcMode)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static JavacErrorDetail` | `createJavacError(String fname, Node.Nodes page, StringBuffer errMsgBuf, int lineNum)`
    `static JavacErrorDetail` | `createJavacError(String fname, Node.Nodes page, StringBuffer errMsgBuf, int lineNum, JspCompilationContext ctxt)`
    `void` | `javacError(JavacErrorDetail[] javacErrors)` Dispatches the given javac compilation errors to the configured error handler.
    `void` | `javacError(String errorReport, Exception e)` Dispatches the given compilation error report and exception to the configured error handler.
    `void` | `jspError(Exception e)` Dispatches the given parsing exception to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Mark where, String errCode)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Mark where, String errCode, String arg)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Mark where, String errCode, String arg1, String arg2)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Mark where, String errCode, String arg1, String arg2, String arg3)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Node n, String errCode)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Node n, String errCode, String arg)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Node n, String errCode, String arg, Exception e)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Node n, String errCode, String arg1, String arg2)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(org.apache.struts2.jasper.compiler.Node n, String errCode, String arg1, String arg2, String arg3)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(String errCode)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(String errCode, String arg)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(String errCode, String arg, Exception e)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(String errCode, String arg1, String arg2)` Dispatches the given JSP parse error to the configured error handler.
    `void` | `jspError(String errCode, String arg1, String arg2, String arg3)` Dispatches the given JSP parse error to the configured error handler.
    `static JavacErrorDetail[]` | `parseJavacErrors(String errMsg, String fname, Node.Nodes page)` Parses the given error message into an array of javac compilation error messages (one per javac compilation error line number).

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ErrorDispatcher

          public ErrorDispatcher(boolean jspcMode)

      Constructor.
      Parameters:
        `jspcMode` - true if compilation has been initiated by JspC, false otherwise

  - ### Method Detail

    - #### jspError

          public void jspError(String errCode)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `errCode` - Error code
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Mark where,
                      String errCode)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `where` - Error location
        `errCode` - Error code
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Node n,
                      String errCode)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `n` - Node that caused the error
        `errCode` - Error code
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(String errCode,
                      String arg)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `errCode` - Error code
        `arg` - Argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Mark where,
                      String errCode,
                      String arg)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `where` - Error location
        `errCode` - Error code
        `arg` - Argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Node n,
                      String errCode,
                      String arg)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `n` - Node that caused the error
        `errCode` - Error code
        `arg` - Argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(String errCode,
                      String arg1,
                      String arg2)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(String errCode,
                      String arg1,
                      String arg2,
                      String arg3)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
        `arg3` - Third argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Mark where,
                      String errCode,
                      String arg1,
                      String arg2)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `where` - Error location
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Mark where,
                      String errCode,
                      String arg1,
                      String arg2,
                      String arg3)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `where` - Error location
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
        `arg3` - Third argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Node n,
                      String errCode,
                      String arg1,
                      String arg2)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `n` - Node that caused the error
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Node n,
                      String errCode,
                      String arg1,
                      String arg2,
                      String arg3)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `n` - Node that caused the error
        `errCode` - Error code
        `arg1` - First argument for parametric replacement
        `arg2` - Second argument for parametric replacement
        `arg3` - Third argument for parametric replacement
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(Exception e)
                        throws JasperException

      Dispatches the given parsing exception to the configured error handler.

      Parameters:
        `e` - Parsing exception
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(String errCode,
                      String arg,
                      Exception e)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `errCode` - Error code
        `arg` - Argument for parametric replacement
        `e` - Parsing exception
      Throws:
        `JasperException` - in case of Jasper errors

    - #### jspError

          public void jspError(org.apache.struts2.jasper.compiler.Node n,
                      String errCode,
                      String arg,
                      Exception e)
                        throws JasperException

      Dispatches the given JSP parse error to the configured error handler.

      The given error code is localized. If it is not found in the resource bundle for localized error messages, it is used as the error message.

      Parameters:
        `n` - Node that caused the error
        `errCode` - Error code
        `arg` - Argument for parametric replacement
        `e` - Parsing exception
      Throws:
        `JasperException` - in case of Jasper errors

    - #### parseJavacErrors

          public static JavacErrorDetail[] parseJavacErrors(String errMsg,
                                            String fname,
                                            Node.Nodes page)
                                                     throws JasperException,
                                                            IOException

      Parses the given error message into an array of javac compilation error messages (one per javac compilation error line number).

      Parameters:
        `errMsg` - Error message
        `fname` - Name of Java source file whose compilation failed
        `page` - Node representation of JSP page from which the Java source file was generated
      Returns:
        Array of javac compilation errors, or null if the given error message does not contain any compilation error line numbers
      Throws:
        `JasperException` - in case of Jasper errors
        `IOException` - in case of IO errors

    - #### javacError

          public void javacError(JavacErrorDetail[] javacErrors)
                          throws JasperException

      Dispatches the given javac compilation errors to the configured error handler.

      Parameters:
        `javacErrors` - Array of javac compilation errors
      Throws:
        `JasperException` - in case of Jasper errors

    - #### javacError

          public void javacError(String errorReport,
                        Exception e)
                          throws JasperException

      Dispatches the given compilation error report and exception to the configured error handler.

      Parameters:
        `errorReport` - Compilation error report
        `e` - Compilation exception
      Throws:
        `JasperException` - in case of Jasper errors

    - #### createJavacError

          public static JavacErrorDetail createJavacError(String fname,
                                          Node.Nodes page,
                                          StringBuffer errMsgBuf,
                                          int lineNum)
                                                   throws JasperException

      Parameters:
        `fname` - Name of the JSP file in which the parse error occurred
        `page` - page
        `errMsgBuf` - error message buffer
        `lineNum` - line number
      Returns:
        JavacErrorDetail The error details
      Throws:
        `JasperException` - in case of Jasper errors

    - #### createJavacError

          public static JavacErrorDetail createJavacError(String fname,
                                          Node.Nodes page,
                                          StringBuffer errMsgBuf,
                                          int lineNum,
                                          JspCompilationContext ctxt)
                                                   throws JasperException

      Parameters:
        `fname` - Name of the JSP file in which the parse error occurred
        `page` - page
        `errMsgBuf` - error message buffer
        `lineNum` - line number
        `ctxt` - JSP compilation context
      Returns:
        JavacErrorDetail The error details
      Throws:
        `JasperException` - in case of Jasper errors

Copyright © 2000–2018 Apache Software Foundation. All rights reserved.