Skip to content
Snippets Groups Projects
Commit 5b70bd92 authored by ribeaudc's avatar ribeaudc
Browse files

change: - No need to copy the beans if they are of same type (we so avoid a...

change: - No need to copy the beans if they are of same type (we so avoid a dead loop that used to occur before this change).

SVN: 6896
parent 194b1aed
No related branches found
No related tags found
No related merge requests found
...@@ -772,7 +772,7 @@ public final class BeanUtils ...@@ -772,7 +772,7 @@ public final class BeanUtils
} }
final Class<T> parameterType = (Class<T>) setter.getParameterTypes()[0]; final Class<T> parameterType = (Class<T>) setter.getParameterTypes()[0];
if (parameterType.isPrimitive() || immutableTypes.contains(parameterType) if (parameterType.isPrimitive() || immutableTypes.contains(parameterType)
|| parameterType.isEnum()) || parameterType.isEnum() || oldBean.getClass().isAssignableFrom(parameterType))
{ {
return (T) oldBean; return (T) oldBean;
} else } else
...@@ -936,7 +936,7 @@ public final class BeanUtils ...@@ -936,7 +936,7 @@ public final class BeanUtils
final List<PropertyDescriptor> descriptors = final List<PropertyDescriptor> descriptors =
new ArrayList<PropertyDescriptor>(Arrays.asList(Introspector.getBeanInfo(clazz) new ArrayList<PropertyDescriptor>(Arrays.asList(Introspector.getBeanInfo(clazz)
.getPropertyDescriptors())); .getPropertyDescriptors()));
for (final Iterator<PropertyDescriptor> iter = descriptors.iterator(); iter.hasNext(); ) for (final Iterator<PropertyDescriptor> iter = descriptors.iterator(); iter.hasNext();)
{ {
final PropertyDescriptor descriptor = iter.next(); final PropertyDescriptor descriptor = iter.next();
// If no write method, remove it. For instance 'class' property does not have any // If no write method, remove it. For instance 'class' property does not have any
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment