------------------------------------------------------------
revno: 6732
committer: Lars Helge Overland <[email protected]>
branch nick: dhis2
timestamp: Wed 2012-04-25 10:51:17 +0200
message:
  Protecting against situations where parent is same as child in 
OrganisationUnitHierarchy
modified:
  
dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.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/organisationunit/OrganisationUnitHierarchy.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java	2012-04-24 12:14:22 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitHierarchy.java	2012-04-25 08:51:17 +0000
@@ -69,6 +69,11 @@
     {
         for ( OrganisationUnitRelationship relation : relations )
         {
+            if ( relation.getParentId() == relation.getChildId() )
+            {
+                continue; // Parent cannot be same as child
+            }
+            
             Set<Integer> children = relationships.get( relation.getParentId() );
             
             if ( children == null )

_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to