dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #35642
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18233: minor NPE check in ReflectionUtils
------------------------------------------------------------
revno: 18233
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2015-02-12 16:17:36 +0700
message:
minor NPE check in ReflectionUtils
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/ReflectionUtils.java 2015-02-12 09:17:36 +0000
@@ -273,6 +273,11 @@
public static Method findSetterMethod( String fieldName, Object target )
{
+ if ( target == null || StringUtils.isEmpty( fieldName ) )
+ {
+ return null;
+ }
+
String[] setterNames = new String[]{
"set"
};
@@ -412,7 +417,7 @@
return methods;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public static <T> T invokeMethod( Object target, Method method, Object... args )
{
if ( target == null || method == null )
@@ -435,7 +440,7 @@
}
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public static <T> T getFieldObject( Field field, T target )
{
return (T) invokeGetterMethod( field.getName(), target );