dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26294
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13030: NPE checks in enrollmentservice
------------------------------------------------------------
revno: 13030
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-11-27 09:25:46 +0100
message:
NPE checks in enrollmentservice
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-14 08:17:57 +0000
+++ 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
@@ -107,6 +107,7 @@
List<ProgramInstance> programInstances = new ArrayList<ProgramInstance>(
programInstanceService.getProgramInstances( programs ) );
+
return getEnrollments( programInstances );
}
@@ -216,7 +217,10 @@
for ( ProgramInstance programInstance : programInstances )
{
- enrollments.getEnrollments().add( getEnrollment( programInstance ) );
+ if ( programInstance != null )
+ {
+ enrollments.getEnrollments().add( getEnrollment( programInstance ) );
+ }
}
return enrollments;
@@ -225,9 +229,9 @@
@Override
public Enrollment getEnrollment( String id )
{
- ProgramInstance pi = programInstanceService.getProgramInstance( id );
-
- return pi != null ? getEnrollment( pi ) : null;
+ ProgramInstance programInstance = programInstanceService.getProgramInstance( id );
+
+ return programInstance != null ? getEnrollment( programInstance ) : null;
}
@Override