dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17145
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6732: Protecting against situations where parent is same as child in OrganisationUnitHierarchy
------------------------------------------------------------
revno: 6732
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
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 )