luehe 2002/08/21 11:22:13
Modified: jasper2/src/share/org/apache/jasper/compiler Validator.java
jasper2/src/share/org/apache/jasper/resources
messages.properties messages_es.properties
messages_ja.properties
Log:
<jsp:doBody>: Cause translation error if a <jsp:param> subelement is specified
with the same name as a variable with a scope of AT_BEGIN or NESTED.
Revision Changes Path
1.26 +41 -3
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java
Index: Validator.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Validator.java 21 Aug 2002 17:05:52 -0000 1.25
+++ Validator.java 21 Aug 2002 18:22:12 -0000 1.26
@@ -904,11 +904,49 @@
}
public void visit(Node.DoBodyAction n) throws JasperException {
+
JspUtil.checkAttributes("DoBody", n, doBodyAttrs, err);
if (n.getAttributeValue("var") != null
&& n.getAttributeValue("varReader") != null) {
err.jspError(n, "jsp.error.doBody.varAndVarReader");
}
+
+ Node.Nodes subelements = n.getBody();
+ if (subelements != null) {
+ for (int i=0; i<subelements.size(); i++) {
+ Node subelem = subelements.getNode(i);
+ if (!(subelem instanceof Node.ParamAction)) {
+ err.jspError(n, "jsp.error.doBody.invalidBodyContent");
+ }
+ }
+ }
+
+ /*
+ * A translation error must occur if a <jsp:param> is specified
+ * with the same name as a variable with a scope of AT_BEGIN or
+ * NESTED.
+ */
+ TagVariableInfo[] tagVars = tagInfo.getTagVariableInfos();
+ if (tagVars != null) {
+ for (int i=0; i<tagVars.length; i++) {
+ if (tagVars[i].getScope() == VariableInfo.AT_END)
+ continue;
+ String varName = tagVars[i].getNameGiven();
+ if (varName == null) {
+ varName = tagData.getAttributeString(
+ tagVars[i].getNameFromAttribute());
+ }
+ for (int j=0; j<subelements.size(); j++) {
+ Node subelem = subelements.getNode(j);
+ String paramName = subelem.getAttributeValue("name");
+ if (varName.equals(paramName)) {
+ err.jspError(n, "jsp.error.doBody.invalidParam",
+ varName);
+ }
+ }
+ }
+ }
+
visitBody(n);
}
}
1.30 +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.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- messages.properties 21 Aug 2002 17:56:03 -0000 1.29
+++ messages.properties 21 Aug 2002 18:22:13 -0000 1.30
@@ -293,5 +293,6 @@
jsp.error.invoke.invalidBodyContent=jsp:invoke contains body content other than
whitespace and jsp:param subelements
jsp.error.invoke.missingParam=Missing jsp:param subelement for variable {0}
jsp.error.doBody.varAndVarReader=Both 'var' and 'varReader' specified in jsp:doBody
+jsp.error.doBody.invalidParam=jsp:doBody has a jsp:param subelement with the same
name as a variable ({0}) with a scope of AT_BEGIN or NESTED
jsp.warning.bad.urlpattern.propertygroup=Bad value {0} in the url-pattern
subelement in web.xml
jsp.error.unknown_attribute_type=Unknown attribute type ({1}) for attribute {0}.
1.9 +2 -1
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties
Index: messages_es.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_es.properties,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- messages_es.properties 21 Aug 2002 17:05:52 -0000 1.8
+++ messages_es.properties 21 Aug 2002 18:22:13 -0000 1.9
@@ -217,3 +217,4 @@
jsp.warning.bad.urlpattern.propertygroup=
jsp.error.invoke.invalidBodyContent=
jsp.error.invoke.missingParam=
+jsp.error.doBody.invalidParam=
1.8 +2 -1
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_ja.properties,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- messages_ja.properties 21 Aug 2002 17:05:52 -0000 1.7
+++ messages_ja.properties 21 Aug 2002 18:22:13 -0000 1.8
@@ -249,3 +249,4 @@
jsp.warning.bad.urlpattern.propertygroup=
jsp.error.invoke.invalidBodyContent=
jsp.error.invoke.missingParam=
+jsp.error.doBody.invalidParam=
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>