← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21058: Identifiable object manager. Fixed inconsistency where null is returned instead of empty list for...

 

------------------------------------------------------------
revno: 21058
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2015-11-15 21:02:14 +0100
message:
  Identifiable object manager. Fixed inconsistency where null is returned instead of empty list for collection return types.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.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-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2015-10-20 19:03:27 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/common/DefaultIdentifiableObjectManager.java	2015-11-15 20:02:14 +0000
@@ -768,7 +768,7 @@
             throw new InvalidIdentifierReferenceException( "Invalid identifiable property / class combination: " + property );
         }
 
-        return null;
+        return new ArrayList<>();
     }
 
     @Override
@@ -779,7 +779,7 @@
 
         if ( store == null )
         {
-            return null;
+            return new ArrayList<>();
         }
 
         return store.getById( identifiers );

=== modified file 'dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java	2015-11-14 20:05:29 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/gml/DefaultGmlImportService.java	2015-11-15 20:02:14 +0000
@@ -284,11 +284,6 @@
     {
         List<OrganisationUnit> orgUnits = idObjectManager.getObjects( OrganisationUnit.class, property, identifiers );
 
-        if ( orgUnits == null )
-        {
-            return Maps.newHashMap();
-        }
-
         return IdentifiableObjectUtils.getMap( orgUnits, property );
     }