Merge "For external group fail with 405 if group endpoint expects internal group"

This commit is contained in:
Shawn Pearce
2013-03-07 15:27:49 +00:00
committed by Gerrit Code Review
2 changed files with 6 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ import static com.google.common.base.Strings.nullToEmpty;
import com.google.common.collect.Lists;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.reviewdb.client.AccountGroupIncludeByUuid;
@@ -51,9 +52,9 @@ public class ListIncludedGroups implements RestReadView<GroupResource> {
@Override
public List<GroupInfo> apply(GroupResource rsrc)
throws ResourceNotFoundException, OrmException {
throws MethodNotAllowedException, ResourceNotFoundException, OrmException {
if (rsrc.toAccountGroup() == null) {
throw new ResourceNotFoundException(rsrc.getGroupUUID().get());
throw new MethodNotAllowedException();
}
boolean ownerOfParent = rsrc.getControl().isOwner();

View File

@@ -20,6 +20,7 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
import com.google.gerrit.common.data.GroupDetail;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.extensions.restapi.MethodNotAllowedException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.RestReadView;
import com.google.gerrit.reviewdb.client.Account;
@@ -59,9 +60,9 @@ public class ListMembers implements RestReadView<GroupResource> {
@Override
public List<AccountInfo> apply(final GroupResource resource)
throws ResourceNotFoundException, OrmException {
throws MethodNotAllowedException, ResourceNotFoundException, OrmException {
if (resource.toAccountGroup() == null) {
throw new ResourceNotFoundException(resource.getGroupUUID().get());
throw new MethodNotAllowedException();
}
try {
final Map<Account.Id, AccountInfo> members =