You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2010/06/14 23:23:24 UTC

svn commit: r954650 - /tomcat/trunk/java/org/apache/jasper/compiler/Validator.java

Author: markt
Date: Mon Jun 14 21:23:23 2010
New Revision: 954650

URL: http://svn.apache.org/viewvc?rev=954650&view=rev
Log:
Fix problem with JSF convertors - restore behaviour prior to r894720 that only checks a subsets of types for validity

Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/Validator.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/Validator.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/Validator.java?rev=954650&r1=954649&r2=954650&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/Validator.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/Validator.java Mon Jun 14 21:23:23 2010
@@ -1159,13 +1159,27 @@ class Validator {
                                             (n, "jsp.error.unknown_attribute_type",
                                              tldAttr.getName(), expectedType);
                                     }
-                                    // Check casting
-                                    try {
-                                        EXPRESSION_FACTORY.coerceToType(attrs.getValue(i), expectedClass);
-                                    } catch (Exception e) {
-                                        err.jspError
-                                            (n, "jsp.error.coerce_to_type",
-                                             tldAttr.getName(), expectedType, attrs.getValue(i));
+                                    // Check casting - not possible for all types
+                                    if (String.class.equals(expectedClass) ||
+                                            expectedClass == Long.TYPE ||
+                                            expectedClass == Double.TYPE ||
+                                            expectedClass == Byte.TYPE ||
+                                            expectedClass == Short.TYPE ||
+                                            expectedClass == Integer.TYPE ||
+                                            expectedClass == Float.TYPE ||
+                                            Number.class.isAssignableFrom(expectedClass) ||
+                                            Character.class.equals(expectedClass) ||
+                                            Character.TYPE == expectedClass ||
+                                            Boolean.class.equals(expectedClass) ||
+                                            Boolean.TYPE == expectedClass ||
+                                            expectedClass.isEnum()) {
+                                        try {
+                                            EXPRESSION_FACTORY.coerceToType(attrs.getValue(i), expectedClass);
+                                        } catch (Exception e) {
+                                            err.jspError
+                                                (n, "jsp.error.coerce_to_type",
+                                                 tldAttr.getName(), expectedType, attrs.getValue(i));
+                                        }
                                     }
                                 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org