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.
| Method from org.apache.jasper.compiler.ErrorDispatcher Detail: |
public static JavacErrorDetail createJavacError(String fname,
Node.Nodes page,
StringBuffer errMsgBuf,
int lineNum) throws JasperException {
return createJavacError(fname, page, errMsgBuf, lineNum, null);
}
|
public static JavacErrorDetail createJavacError(String fname,
Node.Nodes page,
StringBuffer errMsgBuf,
int lineNum,
JspCompilationContext ctxt) throws JasperException {
JavacErrorDetail javacError;
// Attempt to map javac error line number to line in JSP page
ErrorVisitor errVisitor = new ErrorVisitor(lineNum);
page.visit(errVisitor);
Node errNode = errVisitor.getJspSourceNode();
if ((errNode != null) && (errNode.getStart() != null)) {
// If this is a scriplet node then there is a one to one mapping
// between JSP lines and Java lines
if (errVisitor.getJspSourceNode() instanceof Node.Scriptlet) {
javacError = new JavacErrorDetail(
fname,
lineNum,
errNode.getStart().getFile(),
errNode.getStart().getLineNumber() + lineNum -
errVisitor.getJspSourceNode().getBeginJavaLine(),
errMsgBuf,
ctxt);
} else {
javacError = new JavacErrorDetail(
fname,
lineNum,
errNode.getStart().getFile(),
errNode.getStart().getLineNumber(),
errMsgBuf,
ctxt);
}
} else {
/*
* javac error line number cannot be mapped to JSP page
* line number. For example, this is the case if a
* scriptlet is missing a closing brace, which causes
* havoc with the try-catch-finally block that the code
* generator places around all generated code: As a result
* of this, the javac error line numbers will be outside
* the range of begin and end java line numbers that were
* generated for the scriptlet, and therefore cannot be
* mapped to the start line number of the scriptlet in the
* JSP page.
* Include just the javac error info in the error detail.
*/
javacError = new JavacErrorDetail(
fname,
lineNum,
errMsgBuf);
}
return javacError;
}
|
public void javacError(JavacErrorDetail[] javacErrors) throws JasperException {
errHandler.javacError(javacErrors);
}
|
public void javacError(String errorReport,
Exception e) throws JasperException {
errHandler.javacError(errorReport, e);
}
|
public void jspError(String errCode) throws JasperException {
dispatch(null, errCode, null, null);
}
|
public void jspError(Exception e) throws JasperException {
dispatch(null, null, null, e);
}
|
public void jspError(Mark where,
String errCode) throws JasperException {
dispatch(where, errCode, null, null);
}
|
public void jspError(Node n,
String errCode) throws JasperException {
dispatch(n.getStart(), errCode, null, null);
}
|
public void jspError(String errCode,
String arg) throws JasperException {
dispatch(null, errCode, new Object[] {arg}, null);
}
|
public void jspError(Mark where,
String errCode,
String arg) throws JasperException {
dispatch(where, errCode, new Object[] {arg}, null);
}
|
public void jspError(Node n,
String errCode,
String arg) throws JasperException {
dispatch(n.getStart(), errCode, new Object[] {arg}, null);
}
|
public void jspError(String errCode,
String arg1,
String arg2) throws JasperException {
dispatch(null, errCode, new Object[] {arg1, arg2}, null);
}
|
public void jspError(String errCode,
String arg,
Exception e) throws JasperException {
dispatch(null, errCode, new Object[] {arg}, e);
}
|
public void jspError(String errCode,
String arg1,
String arg2,
String arg3) throws JasperException {
dispatch(null, errCode, new Object[] {arg1, arg2, arg3}, null);
}
|
public void jspError(Mark where,
String errCode,
String arg1,
String arg2) throws JasperException {
dispatch(where, errCode, new Object[] {arg1, arg2}, null);
}
|
public void jspError(Node n,
String errCode,
String arg1,
String arg2) throws JasperException {
dispatch(n.getStart(), errCode, new Object[] {arg1, arg2}, null);
}
|
public void jspError(Node n,
String errCode,
String arg,
Exception e) throws JasperException {
dispatch(n.getStart(), errCode, new Object[] {arg}, e);
}
|
public void jspError(Mark where,
String errCode,
String arg1,
String arg2,
String arg3) throws JasperException {
dispatch(where, errCode, new Object[] {arg1, arg2, arg3}, null);
}
|
public void jspError(Node n,
String errCode,
String arg1,
String arg2,
String arg3) throws JasperException {
dispatch(n.getStart(), errCode, new Object[] {arg1, arg2, arg3}, null);
}
|
public static JavacErrorDetail[] parseJavacErrors(String errMsg,
String fname,
Node.Nodes page) throws IOException, JasperException {
return parseJavacMessage(errMsg, fname, page);
}
Parses the given error message into an array of javac compilation error
messages (one per javac compilation error line number). |