------------------------------------------------------------ revno: 12924 committer: Lars Helge Ă˜verland <larshe...@gmail.com> branch nick: dhis2 timestamp: Tue 2013-11-12 09:56:05 +0100 message: Null checks for enrollment 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-04 04:13:54 +0000 +++ dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/enrollment/AbstractEnrollmentService.java 2013-11-12 08:56:05 +0000 @@ -225,7 +225,9 @@ @Override public Enrollment getEnrollment( String id ) { - return getEnrollment( programInstanceService.getProgramInstance( id ) ); + ProgramInstance pi = programInstanceService.getProgramInstance( id ); + + return pi != null ? getEnrollment( pi ) : null; } @Override @@ -290,9 +292,9 @@ @Override public ImportSummary updateEnrollment( Enrollment enrollment ) { - if ( enrollment.getEnrollment() == null ) + if ( enrollment == null || enrollment.getEnrollment() == null ) { - ImportSummary importSummary = new ImportSummary( ImportStatus.ERROR, "No enrollment ID was supplied" ); + ImportSummary importSummary = new ImportSummary( ImportStatus.ERROR, "No enrollment or enrollment ID was supplied" ); importSummary.getImportCount().incrementIgnored(); return importSummary;
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp