← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1928: Too fast when refactoring, getting rid of NPE

 

------------------------------------------------------------
revno: 1928
committer: Jo Størset <storset@xxxxxxxxx>
branch nick: cbhis-mobile
timestamp: Wed 2010-10-20 18:24:53 +0530
message:
  Too fast when refactoring, getting rid of NPE
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.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-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java	2010-10-20 11:54:08 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/DefaultActivityPlanService.java	2010-10-20 12:54:53 +0000
@@ -65,20 +65,12 @@
         DateMidnight to = from.plusMonths( 1 );
 
         Collection<Activity> allActivities = activityPlanService.getActivitiesByProvider( unit );
-        Collection<Activity> activities = new ArrayList<Activity>();
 
         ActivityPlan plan = new ActivityPlan();
 
-        if ( activities == null || activities.isEmpty() )
-        {
-            return plan;
-        }
-
         List<org.hisp.dhis.web.api.model.Activity> items = new ArrayList<org.hisp.dhis.web.api.model.Activity>();
-        plan.setActivitiesList( items );
+
         int i = 0;
-
-        
         for ( Activity activity : allActivities )
         {
             //there are error on db with patientattributeid 14, so I limit the patient to be downloaded
@@ -100,7 +92,10 @@
             	a.setLate(true);
             }
         }
-
+        if (!items.isEmpty()) {
+        	plan.setActivitiesList( items );
+        }
+        
         return plan;
 	}