← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18603: Data set service, fixed nullpointer vulnerability

 

------------------------------------------------------------
revno: 18603
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-03-13 19:50:03 +0100
message:
  Data set service, fixed nullpointer vulnerability
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.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-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataset/DefaultDataSetService.java	2015-03-13 18:50:03 +0000
@@ -162,28 +162,31 @@
     {
         DataSet dataSet = getDataSet( id );
 
-        if ( i18nDataElements )
-        {
-            i18n( i18nService, dataSet.getDataElements() );
-        }
-
-        if ( i18nIndicators )
-        {
-            i18n( i18nService, dataSet.getIndicators() );
-        }
-
-        if ( i18nOrgUnits )
-        {
-            i18n( i18nService, dataSet.getSources() );
-        }
-
-        if ( i18nSections && dataSet.hasSections() )
-        {
-            i18n( i18nService, dataSet.getSections() );
-
-            for ( Section section : dataSet.getSections() )
-            {
-                i18n( i18nService, section.getDataElements() );
+        if ( dataSet != null )
+        {
+            if ( i18nDataElements )
+            {
+                i18n( i18nService, dataSet.getDataElements() );
+            }
+    
+            if ( i18nIndicators )
+            {
+                i18n( i18nService, dataSet.getIndicators() );
+            }
+    
+            if ( i18nOrgUnits )
+            {
+                i18n( i18nService, dataSet.getSources() );
+            }
+    
+            if ( i18nSections && dataSet.hasSections() )
+            {
+                i18n( i18nService, dataSet.getSections() );
+    
+                for ( Section section : dataSet.getSections() )
+                {
+                    i18n( i18nService, section.getDataElements() );
+                }
             }
         }
 
@@ -194,33 +197,8 @@
     public DataSet getDataSet( String id, boolean i18nDataElements, boolean i18nIndicators, boolean i18nOrgUnits, boolean i18nSections )
     {
         DataSet dataSet = getDataSet( id );
-
-        if ( i18nDataElements )
-        {
-            i18n( i18nService, dataSet.getDataElements() );
-        }
-
-        if ( i18nIndicators )
-        {
-            i18n( i18nService, dataSet.getIndicators() );
-        }
-
-        if ( i18nOrgUnits )
-        {
-            i18n( i18nService, dataSet.getSources() );
-        }
-
-        if ( i18nSections && dataSet.hasSections() )
-        {
-            i18n( i18nService, dataSet.getSections() );
-
-            for ( Section section : dataSet.getSections() )
-            {
-                i18n( i18nService, section.getDataElements() );
-            }
-        }
-
-        return dataSet;
+        
+        return dataSet != null ? getDataSet( dataSet.getId(), i18nDataElements, i18nIndicators, i18nOrgUnits, i18nSections ) : null;
     }
 
     @Override