Skip to content

Commit

Permalink
Fixing null pointer when roles are not specified on creating new user
Browse files Browse the repository at this point in the history
  • Loading branch information
rasika committed Jan 23, 2017
1 parent 9a0ba91 commit 704680d
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ public Response addUser(UserInfo userInfo) {
userInfo.getEmailAddress());
// calling addUser method of carbon user api
List<String> tmpRoles = new ArrayList<>();
String[] userInfoRoles = userInfo.getRoles();
tmpRoles.add(DEFAULT_DEVICE_USER);
tmpRoles.addAll(Arrays.asList(userInfo.getRoles()));
if (userInfoRoles != null) {
tmpRoles.addAll(Arrays.asList(userInfoRoles));
}
String[] roles = new String[tmpRoles.size()];
tmpRoles.toArray(roles);

Expand Down

0 comments on commit 704680d

Please sign in to comment.