← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13031: more NPE checks in enrollmentService, there are DBs out there where program.type = 1/2, and patie...

 

------------------------------------------------------------
revno: 13031
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-11-27 10:35:17 +0100
message:
  more NPE checks in enrollmentService, there are DBs out there where program.type = 1/2, and patient == null, so need to check for this, and ignore PI if true
modified:
  dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.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-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java'
--- dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2013-11-27 08:25:46 +0000
+++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java	2013-11-27 09:35:17 +0000
@@ -217,7 +217,9 @@
 
         for ( ProgramInstance programInstance : programInstances )
         {
-            if ( programInstance != null )
+            // check for null, both for pi, and for pi.patient, there are DBs out there where patientid == null
+            // even if the program is of type 1/2.
+            if ( programInstance != null && programInstance.getPatient() != null )
             {
                 enrollments.getEnrollments().add( getEnrollment( programInstance ) );
             }