← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13185: minor fix

 

------------------------------------------------------------
revno: 13185
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-12-10 09:18:47 +0100
message:
  minor fix
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.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-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-12-09 21:32:59 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientStore.java	2013-12-10 08:18:47 +0000
@@ -504,22 +504,25 @@
             String id = keys[1];
             String value = "";
 
+            Integer orgUnitId = -1;
+
             if ( keys.length >= 3 )
             {
                 value = keys[2];
             }
 
-            Integer orgUnitId = -1;
-
-            try
-            {
-                orgUnitId = Integer.parseInt( keys[4] );
-            }
-            catch ( NumberFormatException e )
-            {
-                // handle as uid
-                OrganisationUnit ou = organisationUnitService.getOrganisationUnit( keys[4] );
-                orgUnitId = ou.getId();
+            if ( keys.length > 4 )
+            {
+                try
+                {
+                    orgUnitId = Integer.parseInt( keys[4] );
+                }
+                catch ( NumberFormatException e )
+                {
+                    // handle as uid
+                    OrganisationUnit ou = organisationUnitService.getOrganisationUnit( keys[4] );
+                    orgUnitId = ou.getId();
+                }
             }
 
             if ( keys[0].equals( PREFIX_FIXED_ATTRIBUTE ) )