← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17390: Avoid NullPointerException in getShortName (error in POST /api/users/invite with catDimensionCons...

 

------------------------------------------------------------
revno: 17390
committer: jimgrace@xxxxxxxxx
branch nick: dhis2
timestamp: Sat 2014-11-08 12:30:22 -0500
message:
  Avoid NullPointerException in getShortName (error in POST /api/users/invite with catDimensionConstraints)
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.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/DataElementCategory.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementCategory.java	2014-11-08 17:30:22 +0000
@@ -170,7 +170,7 @@
     @Override
     public String getShortName()
     {
-        if ( getName().length() <= 50 )
+        if ( getName() == null || getName().length() <= 50 )
         {
             return getName();
         }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElementGroupSet.java	2014-11-08 17:30:22 +0000
@@ -211,7 +211,7 @@
     @Override
     public String getShortName()
     {
-        if ( getName().length() <= 50 )
+        if ( getName() == null || getName().length() <= 50 )
         {
             return getName();
         }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2014-08-15 07:40:20 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java	2014-11-08 17:30:22 +0000
@@ -202,7 +202,7 @@
     @Override
     public String getShortName()
     {
-        if ( getName().length() <= 50 )
+        if ( getName() == null || getName().length() <= 50 )
         {
             return getName();
         }

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-11-07 18:23:57 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java	2014-11-08 17:30:22 +0000
@@ -383,7 +383,7 @@
             {
                 UserGroup group = userGroupService.getUserGroup( ug.getUid() );
 
-                if ( group != null && (!writeGroupRequired || securityService.canWrite( group )) )
+                if ( group != null && ( !writeGroupRequired || securityService.canRead( group ) ) )
                 {
                     group.addUser( user );
 

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java	2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/java/org/hisp/dhis/dashboard/usergroup/action/UpdateUserGroupAction.java	2014-11-08 17:30:22 +0000
@@ -134,7 +134,7 @@
             User user = userService.getUser( groupMember );
             userList.add( user );
 
-            if ( writeGroupRequired && !userGroup.getMembers().contains( user) && !userService.canUpdate( user.getUserCredentials() ) )
+            if ( writeGroupRequired && !userGroup.getMembers().contains( user ) && !userService.canUpdate( user.getUserCredentials() ) )
             {
                 throw new UpdateAccessDeniedException( "You don't have permission to add all selected users to this group" );
             }