Merge "For external group fail with 405 if group endpoint expects internal group"
This commit is contained in:
@@ -15,16 +15,16 @@
|
||||
package com.google.gerrit.server.group;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
|
||||
import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gerrit.reviewdb.client.AccountGroup;
|
||||
|
||||
class GetDescription implements RestReadView<GroupResource> {
|
||||
@Override
|
||||
public String apply(GroupResource resource) throws ResourceNotFoundException {
|
||||
public String apply(GroupResource resource) throws MethodNotAllowedException {
|
||||
AccountGroup group = resource.toAccountGroup();
|
||||
if (group == null) {
|
||||
throw new ResourceNotFoundException();
|
||||
throw new MethodNotAllowedException();
|
||||
}
|
||||
return Strings.nullToEmpty(group.getDescription());
|
||||
}
|
||||
|
Reference in New Issue
Block a user