dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26017
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12906: Light module, nullpointer check
------------------------------------------------------------
revno: 12906
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-11-08 15:50:14 +0100
message:
Light module, nullpointer check
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/util/PatientIdentifierGenerator.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-patient/src/main/java/org/hisp/dhis/patient/util/PatientIdentifierGenerator.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/util/PatientIdentifierGenerator.java 2013-11-04 00:01:39 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/util/PatientIdentifierGenerator.java 2013-11-08 14:50:14 +0000
@@ -51,8 +51,14 @@
*/
public static String getNewIdentifier( Date birthDate, String gender )
{
+ if ( birthDate == null || gender == null )
+ {
+ return null;
+ }
+
String noCheck = formatDate( birthDate ) + formatGender( gender )
+ getFixLengthOfNumber( new Random().nextInt( 100000 ), 6 );
+
return noCheck + getCheckdigit( noCheck );
}