← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13053: in FormUtils, only throw NPE if programStage == null and type is single event

 

------------------------------------------------------------
revno: 13053
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-11-28 17:37:03 +0100
message:
  in FormUtils, only throw NPE if programStage == null and type is single event
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.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/api/utils/FormUtils.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java	2013-09-20 15:13:05 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/utils/FormUtils.java	2013-11-28 16:37:03 +0000
@@ -121,7 +121,12 @@
         form.getOptions().put( "type", Program.TYPE_LOOKUP.get( program.getType() ) );
 
         ProgramStage programStage = program.getProgramStageByStage( 1 );
-        Assert.notNull( programStage );
+
+        if ( programStage == null && (Program.SINGLE_EVENT_WITHOUT_REGISTRATION == program.getType()
+            || Program.SINGLE_EVENT_WITH_REGISTRATION == program.getType()) )
+        {
+            throw new NullPointerException();
+        }
 
         form.getOptions().put( "captureCoordinates", programStage.getCaptureCoordinates() );