Fixing null pointer when roles are not specified on creating new user

revert-70aa11f8
Rasika Perera 8 years ago
parent 9a0ba9137b
commit 704680d68d

@ -104,8 +104,11 @@ public class UserManagementServiceImpl implements UserManagementService {
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);

Loading…
Cancel
Save