Permalink
Browse files

fix in resolveValue for null source property values

  • Loading branch information...
1 parent 7c189a4 commit ec4128aa10f42fac45deed4565efb9b14e2659a5 Douglas Rodrigo committed Jun 17, 2011
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/java/br/com/bfmapper/Mapping.java
@@ -303,8 +303,8 @@ private boolean isSimpleType(Class<?> sourceClass, Class<?> targetClass) {
private Object resolveValue(Object source, Object target, String sourceProperty, String targetProperty, Object value, Transformer transformer) {
- Class<?> targetClassAttribute = ReflectionUtils.invokeRecursiveType(target, targetProperty);
- Class<?> sourceClassAttribute = value != null ? value.getClass() : null;
+ Class<?> sourceClassAttribute = ReflectionUtils.invokeRecursiveType(source, sourceProperty);
+ Class<?> targetClassAttribute = ReflectionUtils.invokeRecursiveType(target, targetProperty);
if (ClassUtils.isAssignable(targetClassAttribute, Collection.class) && value instanceof Collection<?>) {
value = this.resolveCollectionValue(source, target, sourceProperty, targetProperty, targetClassAttribute, value, transformer);
@@ -327,7 +327,7 @@ private Object resolveValue(Object source, Object target, String sourceProperty,
} catch (Exception e) {
throw new IllegalArgumentException(e);
}
- } else if (targetClassAttribute.equals(sourceClassAttribute)) {
+ } else if (targetClassAttribute.equals(sourceClassAttribute) && value != null) {
Object returnValue = instanceFactory(targetClassAttribute);
evalEqualsProperties(value, returnValue, null);

0 comments on commit ec4128a

Please sign in to comment.