fixed accidental test failures
This commit is contained in:
parent
9a48f3f3a8
commit
04cd95ff50
|
|
@ -437,6 +437,16 @@ class TypeConverterDelegate {
|
|||
protected Collection convertToTypedCollection(
|
||||
Collection original, String propertyName, Class requiredType, MethodParameter methodParam) {
|
||||
|
||||
boolean originalAllowed = requiredType.isInstance(original);
|
||||
Class elementType = null;
|
||||
if (methodParam != null) {
|
||||
elementType = GenericCollectionTypeResolver.getCollectionParameterType(methodParam);
|
||||
}
|
||||
if (elementType == null && originalAllowed &&
|
||||
!this.propertyEditorRegistry.hasCustomEditorForElement(null, propertyName)) {
|
||||
return original;
|
||||
}
|
||||
|
||||
Iterator it;
|
||||
try {
|
||||
it = original.iterator();
|
||||
|
|
@ -473,16 +483,6 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
boolean originalAllowed = requiredType.isInstance(original);
|
||||
Class elementType = null;
|
||||
if (methodParam != null) {
|
||||
elementType = GenericCollectionTypeResolver.getCollectionParameterType(methodParam);
|
||||
}
|
||||
if (elementType == null && originalAllowed &&
|
||||
!this.propertyEditorRegistry.hasCustomEditorForElement(null, propertyName)) {
|
||||
return original;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (; it.hasNext(); i++) {
|
||||
Object element = it.next();
|
||||
|
|
@ -503,6 +503,18 @@ class TypeConverterDelegate {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map convertToTypedMap(Map original, String propertyName, Class requiredType, MethodParameter methodParam) {
|
||||
boolean originalAllowed = requiredType.isInstance(original);
|
||||
Class keyType = null;
|
||||
Class valueType = null;
|
||||
if (methodParam != null) {
|
||||
keyType = GenericCollectionTypeResolver.getMapKeyParameterType(methodParam);
|
||||
valueType = GenericCollectionTypeResolver.getMapValueParameterType(methodParam);
|
||||
}
|
||||
if (keyType == null && valueType == null && originalAllowed &&
|
||||
!this.propertyEditorRegistry.hasCustomEditorForElement(null, propertyName)) {
|
||||
return original;
|
||||
}
|
||||
|
||||
Iterator it;
|
||||
try {
|
||||
it = original.entrySet().iterator();
|
||||
|
|
@ -539,18 +551,6 @@ class TypeConverterDelegate {
|
|||
return original;
|
||||
}
|
||||
|
||||
boolean originalAllowed = requiredType.isInstance(original);
|
||||
Class keyType = null;
|
||||
Class valueType = null;
|
||||
if (methodParam != null) {
|
||||
keyType = GenericCollectionTypeResolver.getMapKeyParameterType(methodParam);
|
||||
valueType = GenericCollectionTypeResolver.getMapValueParameterType(methodParam);
|
||||
}
|
||||
if (keyType == null && valueType == null && originalAllowed &&
|
||||
!this.propertyEditorRegistry.hasCustomEditorForElement(null, propertyName)) {
|
||||
return original;
|
||||
}
|
||||
|
||||
while (it.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) it.next();
|
||||
Object key = entry.getKey();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -60,6 +60,10 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
|||
return beanName;
|
||||
}
|
||||
|
||||
public void setActualSpouse(TestBean spouse) {
|
||||
setSpouse(spouse);
|
||||
}
|
||||
|
||||
public void setSpouseRef(String name) {
|
||||
setSpouse(new TestBean(name));
|
||||
}
|
||||
|
|
@ -82,4 +86,4 @@ public class DerivedTestBean extends TestBean implements Serializable, BeanNameA
|
|||
return destroyed;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,10 +200,6 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
|
|||
this.spouses = new ITestBean[] {spouse};
|
||||
}
|
||||
|
||||
public void setActualSpouse(TestBean spouse) {
|
||||
this.spouses = new ITestBean[] {spouse};
|
||||
}
|
||||
|
||||
public ITestBean getSpouse() {
|
||||
return (spouses != null ? spouses[0] : null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="pDavid" class="test.beans.TestBean" scope="prototype">
|
||||
<bean id="pDavid" class="test.beans.DerivedTestBean" scope="prototype">
|
||||
<property name="name"><value>David</value></property>
|
||||
<property name="age"><value>27</value></property>
|
||||
<property name="actualSpouse" value="Jen"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue