You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ki...@apache.org on 2003/10/29 22:53:43 UTC
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources messages.properties
kinman 2003/10/29 13:53:43
Modified: jasper2/src/share/org/apache/jasper/compiler Parser.java
jasper2/src/share/org/apache/jasper/resources
messages.properties
Log:
- Fix 10903: Generate errors for unbalanced end tags.
Revision Changes Path
1.84 +33 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java
Index: Parser.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Parser.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- Parser.java 28 Oct 2003 23:04:11 -0000 1.83
+++ Parser.java 29 Oct 2003 21:53:43 -0000 1.84
@@ -1596,7 +1596,8 @@
} else if (reader.matches("<jsp:")) {
parseStandardAction(parent);
} else if (!parseCustomTag(parent)) {
- parseTemplateText(parent);
+ checkUnbalancedEndTag();
+ parseTemplateText(parent);
}
}
@@ -1650,7 +1651,8 @@
} else if (reader.matches("<jsp:")) {
parseStandardAction(parent);
} else if (!parseCustomTag(parent)) {
- parseTemplateText(parent);
+ checkUnbalancedEndTag();
+ parseTemplateText(parent);
}
scriptlessCount--;
@@ -1712,8 +1714,34 @@
err.jspError( reader.mark(), "jsp.error.not.in.template",
"Custom actions" );
} else {
+ checkUnbalancedEndTag();
parseTemplateText(parent);
}
+ }
+
+ /*
+ * Flag as error if an unbalanced end tag appears by itself.
+ */
+ private void checkUnbalancedEndTag() throws JasperException {
+
+ if (!reader.matches("</")) {
+ return;
+ }
+
+ // Check for unbalanced standard actions
+ if (reader.matches("jsp:")) {
+ err.jspError(start, "jsp.error.unbalanced.endtag", "jsp:");
+ }
+
+ // Check for unbalanced custom actions
+ String tagName = reader.parseToken(false);
+ int i = tagName.indexOf(':');
+ if (i == -1 || pageInfo.getURI(tagName.substring(0, i)) == null) {
+ reader.reset(start);
+ return;
+ }
+
+ err.jspError(start, "jsp.error.unbalanced.endtag", tagName);
}
/**
1.134 +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.133
retrieving revision 1.134
diff -u -r1.133 -r1.134
--- messages.properties 9 Sep 2003 21:46:22 -0000 1.133
+++ messages.properties 29 Oct 2003 21:53:43 -0000 1.134
@@ -402,3 +402,4 @@
jsp.error.data.file.read=Error reading file \"{0}\"
jsp.error.prefix.refined=Attempt to redefine the prefix {0} to {1}, when it was already defined as {2} in the current scope.
jsp.error.nested_jsproot=Nested <jsp:root>
+jsp.error.unbalanced.endtag=The end tag \"</{0}\" is unbalanced
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org