← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18501: minor fix

 

------------------------------------------------------------
revno: 18501
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-06 13:58:52 +0700
message:
  minor fix
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.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-api/src/main/java/org/hisp/dhis/schema/Schema.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2015-03-06 06:57:45 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Schema.java	2015-03-06 06:58:52 +0000
@@ -41,6 +41,7 @@
 import org.hisp.dhis.common.IdentifiableObject;
 import org.hisp.dhis.common.NameableObject;
 import org.springframework.core.Ordered;
+import org.springframework.util.StringUtils;
 
 import java.lang.reflect.Method;
 import java.util.List;
@@ -330,9 +331,14 @@
 
     public Method getterByRole( String role )
     {
+        if ( StringUtils.isEmpty( role ) )
+        {
+            return null;
+        }
+
         for ( Property property : propertyMap.values() )
         {
-            if ( property.isCollection() && property.isManyToMany() && (property.getOwningRole().equals( role ) || property.getInverseRole().equals( role )) )
+            if ( property.isCollection() && property.isManyToMany() && (role.equals( property.getOwningRole() ) || role.equals( property.getInverseRole() )) )
             {
                 return property.getGetterMethod();
             }
@@ -343,9 +349,14 @@
 
     public Method setterByRole( String role )
     {
+        if ( StringUtils.isEmpty( role ) )
+        {
+            return null;
+        }
+
         for ( Property property : propertyMap.values() )
         {
-            if ( property.isCollection() && property.isManyToMany() && (property.getOwningRole().equals( role ) || property.getInverseRole().equals( role )) )
+            if ( property.isCollection() && property.isManyToMany() && (role.equals( property.getOwningRole() ) || role.equals( property.getInverseRole() )) )
             {
                 return property.getSetterMethod();
             }