Package org.apache.jasper.compiler
Class ErrorDispatcher
- java.lang.Object
- 
- org.apache.jasper.compiler.ErrorDispatcher
 
- 
 public class ErrorDispatcher extends java.lang.ObjectClass 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 SummaryConstructors Constructor Description ErrorDispatcher(boolean jspcMode)Constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static JavacErrorDetailcreateJavacError(java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page, java.lang.StringBuilder errMsgBuf, int lineNum)Create a compilation error.static JavacErrorDetailcreateJavacError(java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page, java.lang.StringBuilder errMsgBuf, int lineNum, JspCompilationContext ctxt)Create a compilation error.voidjavacError(java.lang.String errorReport, java.lang.Exception e)Dispatches the given compilation error report and exception to the configured error handler.voidjavacError(JavacErrorDetail[] javacErrors)Dispatches the given javac compilation errors to the configured error handler.voidjspError(java.lang.Exception e)Dispatches the given parsing exception to the configured error handler.voidjspError(java.lang.Exception e, java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.voidjspError(java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.voidjspError(org.apache.jasper.compiler.Mark where, java.lang.Exception e, java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.voidjspError(org.apache.jasper.compiler.Mark where, java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.voidjspError(org.apache.jasper.compiler.Node n, java.lang.Exception e, java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.voidjspError(org.apache.jasper.compiler.Node n, java.lang.String errCode, java.lang.String... args)Dispatches the given JSP parse error to the configured error handler.static JavacErrorDetail[]parseJavacErrors(java.lang.String errMsg, java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page)Parses the given error message into an array of javac compilation error messages (one per javac compilation error line number).
 
- 
- 
- 
Method Detail- 
jspErrorpublic void jspError(java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- args- Arguments for parametric replacement
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(org.apache.jasper.compiler.Mark where, java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- args- Arguments for parametric replacement
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(org.apache.jasper.compiler.Node n, java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- args- Arguments for parametric replacement
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(java.lang.Exception e) throws JasperExceptionDispatches the given parsing exception to the configured error handler.- Parameters:
- e- Parsing exception
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(java.lang.Exception e, java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- args- Arguments for parametric replacement
- e- Parsing exception
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(org.apache.jasper.compiler.Mark where, java.lang.Exception e, java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- e- Parsing exception
- errCode- Error code
- args- Arguments for parametric replacement
- Throws:
- JasperException- An error occurred
 
 - 
jspErrorpublic void jspError(org.apache.jasper.compiler.Node n, java.lang.Exception e, java.lang.String errCode, java.lang.String... args) throws JasperExceptionDispatches 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
- e- Parsing exception
- errCode- Error code
- args- Arguments for parametric replacement
- Throws:
- JasperException- An error occurred
 
 - 
parseJavacErrorspublic static JavacErrorDetail[] parseJavacErrors(java.lang.String errMsg, java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page) throws JasperException, java.io.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- An error occurred
- java.io.IOException- IO error which usually should not occur
 
 - 
javacErrorpublic 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- An error occurred
 
 - 
javacErrorpublic void javacError(java.lang.String errorReport, java.lang.Exception e) throws JasperExceptionDispatches the given compilation error report and exception to the configured error handler.- Parameters:
- errorReport- Compilation error report
- e- Compilation exception
- Throws:
- JasperException- An error occurred
 
 - 
createJavacErrorpublic static JavacErrorDetail createJavacError(java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page, java.lang.StringBuilder errMsgBuf, int lineNum) throws JasperException Create a compilation error.- Parameters:
- fname- The file name
- page- The page nodes
- errMsgBuf- The error message
- lineNum- The source line number of the error
- Returns:
- JavacErrorDetail The error details
- Throws:
- JasperException- An error occurred
 
 - 
createJavacErrorpublic static JavacErrorDetail createJavacError(java.lang.String fname, org.apache.jasper.compiler.Node.Nodes page, java.lang.StringBuilder errMsgBuf, int lineNum, JspCompilationContext ctxt) throws JasperException Create a compilation error.- Parameters:
- fname- The file name
- page- The page nodes
- errMsgBuf- The error message
- lineNum- The source line number of the error
- ctxt- The compilation context
- Returns:
- JavacErrorDetail The error details
- Throws:
- JasperException- An error occurred
 
 
- 
 
-