diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java index 4be5446e0b9cef950d2767541fd95acfd0ebfd92..94b888f607b52ea4e053d5d77c13d9ed3ec17021 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java @@ -164,11 +164,11 @@ public class PojoUtils { } public static Object realize(Object pojo, Class type) { - return realize(pojo, type, new HashMap()); + return realize1(pojo, type, new HashMap()); } public static Object realize(Object pojo, Class type, Type genericType) { - return realize(pojo, type, genericType, new HashMap()); + return realize0(pojo, type, genericType, new HashMap()); } private static class PojoInvocationHandler implements InvocationHandler { @@ -194,7 +194,7 @@ public class PojoUtils { value = map.get(methodName.substring(0, 1).toLowerCase() + methodName.substring(1)); } if (value instanceof Map && ! Map.class.isAssignableFrom(method.getReturnType())) { - value = realize((Map)value, method.getReturnType(), new HashMap()); + value = realize1((Map)value, method.getReturnType(), new HashMap()); } return value; } @@ -218,12 +218,12 @@ public class PojoUtils { return new ArrayList(); } - private static Object realize(Object pojo, Class type, final Map history) { - return realize(pojo, type, null , history); + private static Object realize1(Object pojo, Class type, final Map history) { + return realize0(pojo, type, null , history); } @SuppressWarnings({ "unchecked", "rawtypes" }) - private static Object realize(Object pojo, Class type, Type genericType, final Map history) { + private static Object realize0(Object pojo, Class type, Type genericType, final Map history) { if (pojo == null) { return null; } @@ -253,7 +253,7 @@ public class PojoUtils { Collection dest = createCollection(type, len); for (int i = 0; i < len; i ++) { Object obj = Array.get(pojo, i); - Object value = realize(obj, ctype, history); + Object value = realize1(obj, ctype, history); dest.add(value); } return dest; @@ -263,7 +263,7 @@ public class PojoUtils { Object dest = Array.newInstance(ctype, len); for (int i = 0; i < len; i ++) { Object obj = Array.get(pojo, i); - Object value = realize(obj, ctype, history); + Object value = realize1(obj, ctype, history); Array.set(dest, i, value); } return dest; @@ -278,7 +278,7 @@ public class PojoUtils { Object dest = Array.newInstance(ctype, len); int i = 0; for (Object obj : src) { - Object value = realize(obj, ctype, history); + Object value = realize1(obj, ctype, history); Array.set(dest, i, value); i ++; } @@ -293,7 +293,7 @@ public class PojoUtils { if ( keyType instanceof Class){ keyClazz = (Class)keyType; } - Object value = realize(obj, keyClazz, keyType, history); + Object value = realize0(obj, keyClazz, keyType, history); dest.add(value); } return dest; @@ -342,8 +342,8 @@ public class PojoUtils { valueClazz = entry.getValue() == null ? null : entry.getValue().getClass() ; } - Object key = keyClazz == null ? entry.getKey() : realize(entry.getKey(), keyClazz, keyType, history); - Object value = valueClazz == null ? entry.getValue() : realize(entry.getValue(), valueClazz, valueType, history); + Object key = keyClazz == null ? entry.getKey() : realize0(entry.getKey(), keyClazz, keyType, history); + Object value = valueClazz == null ? entry.getValue() : realize0(entry.getValue(), valueClazz, valueType, history); map.put(key, value); } return map; @@ -365,11 +365,12 @@ public class PojoUtils { if (! method.isAccessible()) method.setAccessible(true); Type ptype = method.getGenericParameterTypes()[0]; - value = realize(value, method.getParameterTypes()[0], ptype, history); + value = realize0(value, method.getParameterTypes()[0], ptype, history); try { method.invoke(dest, value); } catch (Exception e) { - throw new RuntimeException("Failed to set pojo " + dest.getClass().getSimpleName() + " property " + name + " value " + value + ", cause: " + e.getMessage(), e); + throw new RuntimeException("Failed to set pojo " + dest.getClass().getSimpleName() + " property " + name + + " value " + value + "(" + value.getClass() + "), cause: " + e.getMessage(), e); } } }