Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46381
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 26 Dec 2008 23:43:09 +0000 (23:43 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 26 Dec 2008 23:43:09 +0000 (23:43 +0000)
Needs testign with the TCK before proposing for 6.0.x

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@729569 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/compiler/Generator.java

index 201e1cc..49dd047 100644 (file)
@@ -836,6 +836,7 @@ class Generator {
         private String attributeValueWithEL(boolean isTag, String tx,
                 Class<?> expectedType, String mapName) {
             if (tx==null) return null;
+            Class<?> type = expectedType;
             int size = tx.length();
             StringBuffer output = new StringBuffer(size);
             boolean el = false;
@@ -851,6 +852,8 @@ class Generator {
                     if (mark < i) {
                         if (output.length() > 0) {
                             output.append(" + ");
+                            // Composite expression - must coerce to String
+                            type = String.class;
                         }
                         output.append(quote(tx.substring(mark, i)));
                     }
@@ -865,10 +868,12 @@ class Generator {
                     // End of an EL expression
                     if (output.length() > 0) {
                         output.append(" + ");
+                        // Composite expression - must coerce to String
+                        type = String.class;
                     }
                     output.append(
                             JspUtil.interpreterCall(isTag,
-                                    tx.substring(mark, i+1), expectedType,
+                                    tx.substring(mark, i+1), type,
                                     mapName, false));
                     mark = i + 1;
                     el = false;