← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12507: Nullpointer vulnerability fix

 

------------------------------------------------------------
revno: 12507
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-10-08 16:12:39 +0200
message:
  Nullpointer vulnerability fix
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.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-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-10-08 13:00:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java	2013-10-08 14:12:39 +0000
@@ -411,6 +411,11 @@
     {
         return url != null && !url.trim().isEmpty();
     }
+    
+    public boolean hasOptionSet()
+    {
+        return optionSet != null;
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2013-09-23 09:50:17 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataentryform/DefaultDataEntryFormService.java	2013-10-08 14:12:39 +0000
@@ -52,6 +52,8 @@
 import org.hisp.dhis.system.util.FilterUtils;
 import org.springframework.transaction.annotation.Transactional;
 
+import static org.hisp.dhis.dataelement.DataElement.*;
+
 /**
  * @author Bharath Kumar
  * @version $Id$
@@ -297,7 +299,7 @@
                 
                 String appendCode = "";
 
-                if ( dataElement.getType().equals( DataElement.VALUE_TYPE_BOOL ) )
+                if ( VALUE_TYPE_BOOL.equals( dataElement.getType() ) )
                 {
                     inputHtml = inputHtml.replace( "input", "select" );
                     inputHtml = inputHtml.replaceAll( "value=\".*?\"", "" );
@@ -309,11 +311,11 @@
                     appendCode += "<option value=\"false\">" + i18n.getString( "no" ) + "</option>";
                     appendCode += "</select>";
                 }
-                else if ( dataElement.getType().equals( DataElement.VALUE_TYPE_TRUE_ONLY ) )
+                else if ( VALUE_TYPE_TRUE_ONLY.equals( dataElement.getType() ) )
                 {
                     appendCode += " name=\"entrytrueonly\" class=\"entrytrueonly\" type=\"checkbox\" tabindex=\"" + i++ + "\"" + TAG_CLOSE;
                 }
-                else if ( dataElement.getOptionSet() != null )
+                else if ( dataElement.hasOptionSet() )
                 {
                     appendCode += " name=\"entryoptionset\" class=\"entryoptionset\" tabindex=\"" + i++ + "\"" + TAG_CLOSE;
                 }