← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16756: Nullpointer vulnerability fixes

 

------------------------------------------------------------
revno: 16756
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-19 18:13:09 +0200
message:
  Nullpointer vulnerability fixes
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.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-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetOrganisationUnitTreeAction.java	2014-09-19 16:13:09 +0000
@@ -197,14 +197,14 @@
 
         User user = currentUserService.getCurrentUser();
 
-        if ( user.getOrganisationUnits() != null && user.getOrganisationUnits().size() > 0 )
+        if ( user != null && user.getOrganisationUnits() != null && user.getOrganisationUnits().size() > 0 )
         {
             userOrganisationUnits = new ArrayList<>( user.getOrganisationUnits() );
             rootOrganisationUnits = new ArrayList<>( user.getOrganisationUnits() );
         }
         else
         {
-            if ( user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
+            if ( user != null && user.getOrganisationUnits() != null && currentUserService.currentUserIsSuper() )
             {
                 userOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );
                 rootOrganisationUnits = new ArrayList<>( organisationUnitService.getRootOrganisationUnits() );

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMetaDataAction.java	2014-09-19 16:13:09 +0000
@@ -215,7 +215,7 @@
     {
         User user = currentUserService.getCurrentUser();
 
-        if ( user.getOrganisationUnits().isEmpty() )
+        if ( user != null && user.getOrganisationUnits().isEmpty() )
         {
             emptyOrganisationUnits = true;