AddMembers.apply: Prevent NPE when account doesn't exist
When trying to add an account to a group, if the account doesn't exist yet and cannot be created, AddMembers.apply() would throw an NPE. Fix it to throw UnprocessableEntityException instead, which is handled by RestApiServlet. Signed-off-by: Jay Soffian <jaysoffian@gmail.com> Change-Id: I724a7b8a95a8df70506ae591575c74153278adc4
This commit is contained in:
@@ -163,7 +163,10 @@ public class AddMembers implements RestModifyView<GroupResource, Input> {
|
||||
case LDAP:
|
||||
if (accountResolver.find(nameOrEmail) == null) {
|
||||
// account does not exist, try to create it
|
||||
return createAccountByLdap(nameOrEmail);
|
||||
Account a = createAccountByLdap(nameOrEmail);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Reference in New Issue
Block a user