Author: remm
Date: Wed Nov 29 13:10:40 2006
New Revision: 480713

URL: http://svn.apache.org/viewvc?view=rev&rev=480713
Log:
- Use a separate method for checking primitives. I'll keep the check for now 
since I have the impression it's tested.

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/el/lang/ELSupport.java
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/el/lang/ELSupport.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/el/lang/ELSupport.java?view=diff&rev=480713&r1=480712&r2=480713
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/el/lang/ELSupport.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/el/lang/ELSupport.java Wed Nov 29 
13:10:40 2006
@@ -316,6 +316,25 @@
         }
     }
 
+    public final static void checkType(final Object obj, final Class type)
+        throws IllegalArgumentException {
+        if (String.class.equals(type)) {
+            coerceToString(obj);
+        }
+        if (ELArithmetic.isNumberType(type)) {
+            coerceToNumber(obj, type);
+        }
+        if (Character.class.equals(type) || Character.TYPE == type) {
+            coerceToCharacter(obj);
+        }
+        if (Boolean.class.equals(type) || Boolean.TYPE == type) {
+            coerceToBoolean(obj);
+        }
+        if (type.isEnum()) {
+            coerceToEnum(obj, type);
+        }
+    }
+
     public final static Object coerceToType(final Object obj, final Class type)
             throws IllegalArgumentException {
         if (type == null || Object.class.equals(type)) {

Modified: tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java?view=diff&rev=480713&r1=480712&r2=480713
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/Validator.java Wed Nov 
29 13:10:40 2006
@@ -1075,7 +1075,7 @@
                                     }
                                     // Check casting
                                     try {
-                                        
ELSupport.coerceToType(attrs.getValue(i), expectedClass);
+                                        ELSupport.checkType(attrs.getValue(i), 
expectedClass);
                                     } catch (Exception e) {
                                         err.jspError
                                             (n, "jsp.error.coerce_to_type",



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to