Permalink
Browse files

Merge pull request #282 from QinChery/patch-3

Update ObjectUtils.java
2 parents 8fcdf70 + 94f0602 commit a9f1524d4ff782656b9cef0c5b4f4eea6eb41c4f @think-gem think-gem committed on GitHub Dec 31, 2016
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/main/java/com/thinkgem/jeesite/common/utils/ObjectUtils.java
@@ -26,16 +26,16 @@
public static void annotationToObject(Object annotation, Object object){
if (annotation != null){
Class<?> annotationClass = annotation.getClass();
+ if (null == object) {
+ return;
+ }
Class<?> objectClass = object.getClass();
for (Method m : objectClass.getMethods()){
if (StringUtils.startsWith(m.getName(), "set")){
try {
String s = StringUtils.uncapitalize(StringUtils.substring(m.getName(), 3));
Object obj = annotationClass.getMethod(s).invoke(annotation);
if (obj != null && !"".equals(obj.toString())){
- if (object == null){
- object = objectClass.newInstance();
- }
m.invoke(object, obj);
}
} catch (Exception e) {

0 comments on commit a9f1524

Please sign in to comment.