ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1488892 - /ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java
Date Mon, 03 Jun 2013 08:42:13 GMT
Author: bramk
Date: Mon Jun  3 08:42:13 2013
New Revision: 1488892

URL: http://svn.apache.org/r1488892
Log:
ACE-339 Prevent some NPEs that occur when useradmin has no data

Modified:
    ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java

Modified: ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java?rev=1488892&r1=1488891&r2=1488892&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java
(original)
+++ ace/trunk/org.apache.ace.useradmin.ui/src/org/apache/ace/useradmin/ui/editor/impl/UserEditorImpl.java
Mon Jun  3 08:42:13 2013
@@ -154,10 +154,12 @@ public class UserEditorImpl implements U
         List<UserDTO> tempData = new ArrayList<UserDTO>();
         try {
             Role[] roles = m_useradmin.getRoles(null);
-            for (Role role : roles) {
-                if (role.getType() == Role.USER) {
-                    User user = (User) role;
-                    tempData.add(new UserDTO((User) role, getGroup(user)));
+            if (roles != null) {
+                for (Role role : roles) {
+                    if (role.getType() == Role.USER) {
+                        User user = (User) role;
+                        tempData.add(new UserDTO((User) role, getGroup(user)));
+                    }
                 }
             }
         }
@@ -172,9 +174,11 @@ public class UserEditorImpl implements U
         List<Group> tempGroups = new ArrayList<Group>();
         try {
             Role[] roles = m_useradmin.getRoles("(type=userGroup)");
-            for (Role role : roles) {
-                if (role.getType() == Role.GROUP) {
-                    tempGroups.add((Group) role);
+            if (roles != null) {
+                for (Role role : roles) {
+                    if (role.getType() == Role.GROUP) {
+                        tempGroups.add((Group) role);
+                    }
                 }
             }
         }
@@ -189,9 +193,11 @@ public class UserEditorImpl implements U
         List<User> tempUsers = new ArrayList<User>();
         try {
             Role[] roles = m_useradmin.getRoles(null);
-            for (Role role : roles) {
-                if (role.getType() == Role.USER) {
-                    tempUsers.add((User) role);
+            if (roles != null) {
+                for (Role role : roles) {
+                    if (role.getType() == Role.USER) {
+                        tempUsers.add((User) role);
+                    }
                 }
             }
         }
@@ -210,9 +216,12 @@ public class UserEditorImpl implements U
                 Role result = m_useradmin.getRole(role);
                 if (result.getType() == Role.GROUP) {
                     Group group = (Group) result;
-                    for (Role r : group.getMembers()) {
-                        if (r.getType() == Role.USER && r.getName().equals(user.getName()))
{
-                            return group;
+                    Role[] members = group.getMembers();
+                    if (members != null) {
+                        for (Role r : members) {
+                            if (r.getType() == Role.USER && r.getName().equals(user.getName()))
{
+                                return group;
+                            }
                         }
                     }
                 }



Mime
View raw message