← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10692: Fixed nullpointer vulnerability for data set reports

 

------------------------------------------------------------
revno: 10692
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-04-25 19:34:28 +0200
message:
  Fixed nullpointer vulnerability for data set reports
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.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/dataset/Section.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2013-02-27 10:24:44 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/Section.java	2013-04-25 17:34:28 +0000
@@ -149,6 +149,11 @@
 
         return false;
     }
+    
+    public boolean hasDataElements()
+    {
+        return dataElements != null && !dataElements.isEmpty();
+    }
 
     // -------------------------------------------------------------------------
     // Getters and setters

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2013-01-05 15:22:55 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/impl/DefaultDataSetReportService.java	2013-04-25 17:34:28 +0000
@@ -144,6 +144,11 @@
 
         for ( Section section : sections )
         {
+            if ( !section.hasDataElements() || section.getCategoryCombo() == null )
+            {
+                continue;
+            }
+            
             Grid grid = new ListGrid().setTitle( section.getName() ).
                 setSubtitle( unit.getName() + SPACE + format.formatPeriod( period ) );