← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17035: OUWT, null check instead of runtime exception

 

------------------------------------------------------------
revno: 17035
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-10-10 13:42:22 +0200
message:
  OUWT, null check instead of runtime exception
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.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-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/SetSelectedOrganisationUnitAction.java	2014-10-10 11:42:22 +0000
@@ -93,16 +93,14 @@
 
         OrganisationUnit unit = organisationUnitService.getOrganisationUnit( id );
 
-        if ( unit == null )
+        if ( unit != null )
         {
-            throw new RuntimeException( "OrganisationUnit with id " + id + " doesn't exist" );
+            selectedUnits = new HashSet<>( 1 );
+            selectedUnits.add( unit );
+    
+            selectionManager.setSelectedOrganisationUnits( selectedUnits );
         }
-
-        selectedUnits = new HashSet<>( 1 );
-        selectedUnits.add( unit );
-
-        selectionManager.setSelectedOrganisationUnits( selectedUnits );
-
+        
         return SUCCESS;
     }
 }