Skip to content

Commit

Permalink
https://github.com/knightliao/disconf/issues/89
Browse files Browse the repository at this point in the history
fix bug
  • Loading branch information
knightliao committed May 31, 2016
1 parent 0a3e684 commit 45d2a0f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,30 @@ public boolean isStatic() {
*/
public Object setValue4StaticFileItem(Object value) throws Exception {

if (setMethod != null) {
setMethod.invoke(null, value);
} else {
field.set(null, value);
try {
if (setMethod != null) {
setMethod.invoke(null, value);
} else {
field.set(null, value);
}

} catch (Exception e) {
LOGGER.warn(e.toString());
}

return value;
}

public Object setValue4FileItem(Object object, Object value) throws Exception {

if (setMethod != null) {
setMethod.invoke(object, value);
} else {
field.set(object, value);
try {
if (setMethod != null) {
setMethod.invoke(object, value);
} else {
field.set(object, value);
}
} catch (Exception e) {
LOGGER.warn(e.toString());
}

return value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ public static Method getSetterMethodFromField(Class<?> curClass, Field field) {

Set<Method> methods = ClassUtils.getAllMethod(curClass);
for (Method method : methods) {
if (method.getName().toLowerCase().equals("set" + fieldName) || method.getName().toLowerCase().equals("is" +
fieldName)) {
if (method.getName().toLowerCase().equals("set" + fieldName)) {
return method;
}
}
Expand Down

0 comments on commit 45d2a0f

Please sign in to comment.