------------------------------------------------------------ revno: 2669 committer: Jo Størset <stor...@gmail.com> branch nick: dhis2 timestamp: Thu 2011-01-20 15:55:24 +0530 message: Avoid chokning on identifers with type null. modified: dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.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/ActivityReportingServiceImpl.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-01-17 06:28:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/web/api/service/ActivityReportingServiceImpl.java 2011-01-20 10:25:24 +0000 @@ -46,6 +46,7 @@ import org.hisp.dhis.patient.Patient; import org.hisp.dhis.patient.PatientAttributeService; import org.hisp.dhis.patient.PatientIdentifier; +import org.hisp.dhis.patient.PatientIdentifierType; import org.hisp.dhis.patient.PatientMobileSetting; import org.hisp.dhis.patient.PatientMobileSettingService; import org.hisp.dhis.patientattributevalue.PatientAttributeValue; @@ -265,8 +266,18 @@ for ( PatientIdentifier id : patientIdentifiers ) { - identifiers.add( new org.hisp.dhis.web.api.model.PatientIdentifier( id.getIdentifierType().getName(), - id.getIdentifier() ) ); + + String idTypeName = "DHIS2 ID"; + + // MIGHT BE NULL because of strange design.. + PatientIdentifierType identifierType = id.getIdentifierType(); + + if ( identifierType != null ) + { + idTypeName = identifierType.getName(); + } + + identifiers.add( new org.hisp.dhis.web.api.model.PatientIdentifier( idTypeName, id.getIdentifier() ) ); } beneficiary.setIdentifiers( identifiers );
_______________________________________________ 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