From: markt Date: Fri, 15 Jan 2010 19:22:12 +0000 (+0000) Subject: Fix TCK failure. Trying to assign an object of the wrong type to an array should... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3118cbda247f88bd5da92e208a0fa17a9bbe62e3;p=tomcat7.0 Fix TCK failure. Trying to assign an object of the wrong type to an array should throw a ClassCaseException. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899769 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/javax/el/ArrayELResolver.java b/java/javax/el/ArrayELResolver.java index 8165bec40..2e7f70ee6 100644 --- a/java/javax/el/ArrayELResolver.java +++ b/java/javax/el/ArrayELResolver.java @@ -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); } }