Package org.apache.jasper.compiler
Class ErrorDispatcher
java.lang.Object
org.apache.jasper.compiler.ErrorDispatcher
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
-
Method Summary
Modifier and TypeMethodDescriptionstatic JavacErrorDetail
createJavacError
(String fname, org.apache.jasper.compiler.Node.Nodes page, StringBuilder errMsgBuf, int lineNum) Create a compilation error.static JavacErrorDetail
createJavacError
(String fname, org.apache.jasper.compiler.Node.Nodes page, StringBuilder errMsgBuf, int lineNum, JspCompilationContext ctxt) Create a compilation error.void
javacError
(String errorReport, Exception e) Dispatches the given compilation error report and exception to the configured error handler.void
javacError
(JavacErrorDetail[] javacErrors) Dispatches the given javac compilation errors to the configured error handler.void
Dispatches the given parsing exception to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.void
Dispatches the given JSP parse error to the configured error handler.static JavacErrorDetail[]
parseJavacErrors
(String errMsg, 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).
-
Constructor Details
-
ErrorDispatcher
public ErrorDispatcher(boolean jspcMode) Constructor.- Parameters:
jspcMode
- true if compilation has been initiated by JspC, false otherwise
-
-
Method Details
-
jspError
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 codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
jspError
public void jspError(org.apache.jasper.compiler.Mark where, String errCode, String... args) 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 locationerrCode
- Error codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
jspError
public void jspError(org.apache.jasper.compiler.Node n, String errCode, String... args) 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 errorerrCode
- Error codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
jspError
Dispatches the given parsing exception to the configured error handler.- Parameters:
e
- Parsing exception- Throws:
JasperException
- An error occurred
-
jspError
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:
e
- Parsing exceptionerrCode
- Error codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
jspError
public void jspError(org.apache.jasper.compiler.Mark where, Exception e, String errCode, String... args) 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 locatione
- Parsing exceptionerrCode
- Error codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
jspError
public void jspError(org.apache.jasper.compiler.Node n, Exception e, String errCode, String... args) 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 errore
- Parsing exceptionerrCode
- Error codeargs
- Arguments for parametric replacement- Throws:
JasperException
- An error occurred
-
parseJavacErrors
public static JavacErrorDetail[] parseJavacErrors(String errMsg, String fname, org.apache.jasper.compiler.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 messagefname
- Name of Java source file whose compilation failedpage
- 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 occurredIOException
- IO error which usually should not occur
-
javacError
Dispatches the given javac compilation errors to the configured error handler.- Parameters:
javacErrors
- Array of javac compilation errors- Throws:
JasperException
- An error occurred
-
javacError
Dispatches the given compilation error report and exception to the configured error handler.- Parameters:
errorReport
- Compilation error reporte
- Compilation exception- Throws:
JasperException
- An error occurred
-
createJavacError
public static JavacErrorDetail createJavacError(String fname, org.apache.jasper.compiler.Node.Nodes page, StringBuilder errMsgBuf, int lineNum) throws JasperException Create a compilation error.- Parameters:
fname
- The file namepage
- The page nodeserrMsgBuf
- The error messagelineNum
- The source line number of the error- Returns:
- JavacErrorDetail The error details
- Throws:
JasperException
- An error occurred
-
createJavacError
public static JavacErrorDetail createJavacError(String fname, org.apache.jasper.compiler.Node.Nodes page, StringBuilder errMsgBuf, int lineNum, JspCompilationContext ctxt) throws JasperException Create a compilation error.- Parameters:
fname
- The file namepage
- The page nodeserrMsgBuf
- The error messagelineNum
- The source line number of the errorctxt
- The compilation context- Returns:
- JavacErrorDetail The error details
- Throws:
JasperException
- An error occurred
-