luehe 2002/08/29 12:22:00
Modified: jasper2/src/share/org/apache/jasper/compiler Generator.java
Log:
Fixed 11742 ("jsp:attribute with a non string body")
Revision Changes Path
1.84 +22 -11
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
Index: Generator.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- Generator.java 28 Aug 2002 23:00:18 -0000 1.83
+++ Generator.java 29 Aug 2002 19:22:00 -0000 1.84
@@ -2506,8 +2506,13 @@
// XXX assert(c.length > 0)
}
- if (attrs[i].isExpression() || attrs[i].isNamedAttribute()) {
+ if (attrs[i].isExpression()) {
// Do nothing
+ } else if (attrs[i].isNamedAttribute()) {
+ attrValue = convertString(
+ c[0], attrValue, attrName,
+ handlerInfo.getPropertyEditorClass(attrName),
+ false);
} else if (attrs[i].isELInterpreterInput()) {
// run attrValue through the expression interpreter
attrValue = JspUtil.interpreterCall(this.isTagFile,
@@ -2515,7 +2520,8 @@
} else {
attrValue = convertString(
c[0], attrValue, attrName,
- handlerInfo.getPropertyEditorClass(attrName));
+ handlerInfo.getPropertyEditorClass(attrName),
+ true);
}
if (attrs[i].isDynamic()) {
@@ -2546,17 +2552,22 @@
}
private String convertString(Class c, String s, String attrName,
- Class propEditorClass)
+ Class propEditorClass, boolean quote)
throws JasperException {
-
+
+ String quoted = s;
+ if (quote) {
+ quoted = quote(s);
+ }
+
if (propEditorClass != null) {
return "(" + c.getName()
+ ")JspRuntimeLibrary.getValueFromBeanInfoPropertyEditor("
+ c.getName() + ".class, \"" + attrName + "\", "
- + quote(s) + ", "
+ + quoted + ", "
+ propEditorClass.getName() + ".class)";
} else if (c == String.class) {
- return quote(s);
+ return quoted;
} else if (c == boolean.class) {
return Boolean.valueOf(s).toString();
} else if (c == Boolean.class) {
@@ -2606,12 +2617,12 @@
} else if (c == Long.class) {
return "new Long(" + Long.valueOf(s).toString() + "l)";
} else if (c == Object.class) {
- return "new String(" + quote(s) + ")";
+ return "new String(" + quoted + ")";
} else {
return "(" + c.getName()
+ ")JspRuntimeLibrary.getValueFromPropertyEditorManager("
+ c.getName() + ".class, \"" + attrName + "\", "
- + quote(s) + ")";
+ + quoted + ")";
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>