← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11795: fixes NPE in SharingUtils.canExernalize

 

------------------------------------------------------------
revno: 11795
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Sun 2013-08-25 23:44:57 +0200
message:
  fixes NPE in SharingUtils.canExernalize
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.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/common/SharingUtils.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-08-23 17:19:21 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/SharingUtils.java	2013-08-25 21:44:57 +0000
@@ -336,6 +336,11 @@
      */
     public static <T extends IdentifiableObject> boolean canExternalize( User user, T object )
     {
+        if ( user == null )
+        {
+            return false;
+        }
+
         Set<String> authorities = user.getUserCredentials().getAllAuthorities();
 
         return EXTERNAL_AUTHORITIES.get( object.getClass() ) != null &&