fixed bug related to array autogrow
This commit is contained in:
parent
8df6b86dd1
commit
90d8dade25
|
|
@ -848,8 +848,9 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
for (int i = length; i < Array.getLength(newArray); i++) {
|
for (int i = length; i < Array.getLength(newArray); i++) {
|
||||||
Array.set(newArray, i, newValue(componentType, name));
|
Array.set(newArray, i, newValue(componentType, name));
|
||||||
}
|
}
|
||||||
|
// TODO this is not efficient because conversion may create a copy ... set directly because we know its assignable.
|
||||||
setPropertyValue(name, newArray);
|
setPropertyValue(name, newArray);
|
||||||
return newArray;
|
return getPropertyValue(name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return array;
|
return array;
|
||||||
|
|
@ -953,10 +954,6 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra
|
||||||
// TODO reduce this grow algorithm along side the null gap algorithm for setting lists below ... the two are inconsistent
|
// TODO reduce this grow algorithm along side the null gap algorithm for setting lists below ... the two are inconsistent
|
||||||
propValue = growArrayIfNecessary(propValue, arrayIndex, actualName);
|
propValue = growArrayIfNecessary(propValue, arrayIndex, actualName);
|
||||||
Array.set(propValue, arrayIndex, convertedValue);
|
Array.set(propValue, arrayIndex, convertedValue);
|
||||||
PropertyValue newValue = new PropertyValue(actualName, propValue);
|
|
||||||
newValue.resolvedDescriptor = pd;
|
|
||||||
newValue.conversionNecessary = false;
|
|
||||||
setPropertyValue(newValue);
|
|
||||||
}
|
}
|
||||||
catch (IndexOutOfBoundsException ex) {
|
catch (IndexOutOfBoundsException ex) {
|
||||||
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
throw new InvalidPropertyException(getRootClass(), this.nestedPath + propertyName,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.core.convert.converter.Converter;
|
import org.springframework.core.convert.converter.Converter;
|
||||||
import org.springframework.core.convert.support.ConversionServiceFactory;
|
import org.springframework.core.convert.support.ConversionServiceFactory;
|
||||||
|
|
@ -92,7 +91,6 @@ public class Spr7839Tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void arrayOfLists() throws Exception {
|
public void arrayOfLists() throws Exception {
|
||||||
// TODO TypeDescriptor not capable of accessing nested element type for arrays
|
// TODO TypeDescriptor not capable of accessing nested element type for arrays
|
||||||
request.setRequestURI("/nested/arrayOfLists");
|
request.setRequestURI("/nested/arrayOfLists");
|
||||||
|
|
@ -101,7 +99,6 @@ public class Spr7839Tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Ignore
|
|
||||||
public void map() throws Exception {
|
public void map() throws Exception {
|
||||||
request.setRequestURI("/nested/map");
|
request.setRequestURI("/nested/map");
|
||||||
request.addParameter("nested.map['apple'].foo", "bar");
|
request.addParameter("nested.map['apple'].foo", "bar");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue