← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12975: more concurrency fixes

 

------------------------------------------------------------
revno: 12975
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-11-19 16:20:52 +0100
message:
  more concurrency fixes
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.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-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-11-19 14:33:28 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/user/CurrentUserController.java	2013-11-19 15:20:52 +0000
@@ -467,17 +467,25 @@
 
         if ( parameters.containsKey( "includeDescendants" ) && Boolean.parseBoolean( parameters.get( "includeDescendants" ) ) )
         {
+            List<OrganisationUnit> children = new ArrayList<OrganisationUnit>();
+
             for ( OrganisationUnit organisationUnit : userOrganisationUnits )
             {
-                userOrganisationUnits.addAll( organisationUnitService.getOrganisationUnitsWithChildren( organisationUnit.getUid() ) );
+                children.addAll( organisationUnitService.getOrganisationUnitsWithChildren( organisationUnit.getUid() ) );
             }
+
+            userOrganisationUnits.addAll( children );
         }
         else
         {
+            List<OrganisationUnit> children = new ArrayList<OrganisationUnit>();
+
             for ( OrganisationUnit organisationUnit : userOrganisationUnits )
             {
-                userOrganisationUnits.addAll( organisationUnit.getChildren() );
+                children.addAll( organisationUnit.getChildren() );
             }
+
+            userOrganisationUnits.addAll( children );
         }
 
         for ( OrganisationUnit ou : userOrganisationUnits )