← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6641: Fixed bug: IndexOutOfBoundsException at dhis/mobile/selectOrganisationUnit.action

 

------------------------------------------------------------
revno: 6641
committer: Em <em.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-19 14:55:29 +0700
message:
  Fixed bug: IndexOutOfBoundsException at dhis/mobile/selectOrganisationUnit.action
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.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-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java	2012-01-23 09:28:45 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/dataentry/action/GetOrganisationUnitsAction.java	2012-04-19 07:55:29 +0000
@@ -91,33 +91,41 @@
     {
         organisationUnits = formUtils.getSortedOrganisationUnitsForCurrentUser();
 
-        if ( organisationUnits.size() == 1 )
+        try
         {
-            for ( OrganisationUnit organisationUnit : organisationUnits )
+            if ( organisationUnits.size() == 1 )
             {
-                for ( OrganisationUnit child : organisationUnit.getChildren() )
+                for ( OrganisationUnit organisationUnit : organisationUnits )
                 {
-                    if ( child.getDataSets().size() > 0 )
+                    for ( OrganisationUnit child : organisationUnit.getChildren() )
                     {
-                        return SUCCESS;
+                        if ( child.getDataSets().size() > 0 ) // >0
+                        {
+                            return SUCCESS;
+                        }
                     }
                 }
-            }
-
-            organisationUnitId = organisationUnits.get( 0 ).getId();
-
-            List<DataSet> dataSets = formUtils.getDataSetsForCurrentUser( organisationUnitId );
-
-            if ( dataSets.size() > 1 )
-            {
-                return "selectDataSet";
-            }
-
-            dataSetId = dataSets.get( 0 ).getId();
-
-            return "selectPeriod";
-        }
-
+                organisationUnitId = organisationUnits.get( 0 ).getId();
+
+                List<DataSet> dataSets = formUtils.getDataSetsForCurrentUser( organisationUnitId );
+
+                if ( dataSets.size() > 1 )
+                {
+                    return "selectDataSet";
+                }
+
+                dataSetId = dataSets.get( 0 ).getId();
+
+                return "selectPeriod";
+            }
+
+        }
+        catch ( Exception e )
+        {
+
+        }
         return SUCCESS;
+
     }
+
 }