luehe 2002/07/24 12:58:57
Modified:jasper2/src/share/org/apache/jasper/resources
messages.properties
jasper2/src/share/org/apache/jasper/compiler
JspDocumentParser.java ErrorDispatcher.java
DefaultErrorHandler.java
Log:
added error message for jsp.error.parse.xml.scripting.invalid.body error code +
fixed NPE in ErrorDispatcher
Revision ChangesPath
1.13 +2 -1
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
Index: messages.properties
===
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- messages.properties 22 Jul 2002 20:35:27 - 1.12
+++ messages.properties 24 Jul 2002 19:58:57 - 1.13
@@ -231,6 +231,7 @@
jsp.error.no.more.content=End of content reached while more parsing required: tag
nesting error?
jsp.error.parse.xml=XML parsing error on file {0}: {1}
jsp.error.parse.xml.line=XML parsing error on file {0}: (line {1}, col {2}): {3}
+jsp.error.parse.xml.scripting.invalid.body=Body of {0} element must not contain any
XML elements
jsp.error.internal.tldinit=Exception initializing TldLocationsCache: {0}
jsp.error.internal.filenotfound=Internal Error: File {0} not found
jsp.error.internal.evaluator_not_found=Internal error: unable to load expression
evaluator
1.8 +15 -7
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java
Index: JspDocumentParser.java
===
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JspDocumentParser.java22 Jul 2002 23:02:55 - 1.7
+++ JspDocumentParser.java24 Jul 2002 19:58:57 - 1.8
@@ -314,7 +314,7 @@
}
if (current instanceof Node.ScriptingElement) {
- checkScriptingBody(current.getBody());
+ checkScriptingBody((Node.ScriptingElement) current);
}
if (current.getParent() != null) {
@@ -495,18 +495,26 @@
* Ensures that the given body only contains nodes that are instances of
* TemplateText.
*
- * This check is performed only for the body of a scripting (that is, a
+ * This check is performed only for the body of a scripting (that is:
* declaration, scriptlet, or expression) element, after the end tag of a
* scripting element has been reached.
*/
-private void checkScriptingBody(Node.Nodes body) throws SAXException {
+private void checkScriptingBody(Node.ScriptingElement scriptingElem)
+ throws SAXException {
+ Node.Nodes body = scriptingElem.getBody();
if (body != null) {
int size = body.size();
for (int i=0; isize; i++) {
Node n = body.getNode(i);
if (!(n instanceof Node.TemplateText)) {
+ String elemType = TagConstants.JSP_SCRIPTLET;
+ if (scriptingElem instanceof Node.Declaration)
+ elemType = TagConstants.JSP_DECLARATION;
+ if (scriptingElem instanceof Node.Expression)
+ elemType = TagConstants.JSP_EXPRESSION;
String msg = err.getString(
-jsp.error.parse.xml.scripting.invalid.body);
+jsp.error.parse.xml.scripting.invalid.body,
+ elemType);
throw new SAXException(msg);
}
}
1.3 +10 -5
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java
Index: ErrorDispatcher.java
===
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ErrorDispatcher.java 15 May 2002 20:42:03 - 1.2
+++ ErrorDispatcher.java 24 Jul 2002 19:58:57 - 1.3
@@ -391,11 +391,15 @@
private void dispatch(Mark where, String errCode, Object[] args,
Exception e) throws JasperException {
String file = null;
+ String errMsg = null;
int line = -1;
int column = -1;
// Localize
- String errMsg = getString(errCode, args);
+
+ if (errCode != null) {
+ errMsg = getString(errCode, args);
+ }
// Get error location
if (where !=