From 9be513d22587320f70adfa954e0c2b7a91df5a14 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 3 Jul 2011 20:12:18 +0000 Subject: [PATCH] regular IndexOutOfBoundsException if index beyond auto-grow limit git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4654 50f2f4bb-b051-0410-bef5-90022cba6387 --- .../java/org/springframework/beans/BeanWrapperImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index ce3c9597f23..e00b9ba1ad9 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -990,10 +990,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra oldValue = list.get(index); } Object convertedValue = convertIfNecessary(propertyName, oldValue, pv.getValue(), requiredType, TypeDescriptor.nested(property(pd), tokens.keys.length)); - if (index < size) { - list.set(index, convertedValue); - } - else if (index >= size && index < this.autoGrowCollectionLimit) { + if (index >= size && index < this.autoGrowCollectionLimit) { for (int i = size; i < index; i++) { try { list.add(null); @@ -1007,6 +1004,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra } list.add(convertedValue); } + else { + list.set(index, convertedValue); + } } else if (propValue instanceof Map) { PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(actualName);