Fix TCK failure. Trying to assign an object of the wrong type to an array should...
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 15 Jan 2010 19:22:12 +0000 (19:22 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 15 Jan 2010 19:22:12 +0000 (19:22 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899769 13f79535-47bb-0310-9956-ffa450edef68

java/javax/el/ArrayELResolver.java

index 8165bec..2e7f70e 100644 (file)
@@ -90,6 +90,14 @@ public class ArrayELResolver extends ELResolver {
 
                        int idx = coerce(property);
                        checkBounds(base, idx);
+                       if (value != null &&
+                               !base.getClass().getComponentType().isAssignableFrom(
+                                       value.getClass())) {
+                           throw new ClassCastException(message(context,
+                                   "objectNotAssignable",
+                                   new Object[] {value.getClass().getName(),
+                                   base.getClass().getComponentType().getName()}));
+                       }
                        Array.set(base, idx, value);
                }
        }