dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09858
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2669: Avoid chokning on identifers with type null.
------------------------------------------------------------
revno: 2669
committer: Jo Størset <storset@xxxxxxxxx>
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 );