Fix error message when --query and --query2 are both used on GET /groups/
--query and --query2 on GET /groups/ are mutually exclusive. Using both of these options at the same time already failed because the QueryGroups REST endpoint was always returned when --query2 was specified and QueryGroups was rejecting --query with: "--query" is not a valid option Change-Id: I89aa4ea8c7f5ed8e354e0cf42635b96aba7ed93e Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -22,6 +22,7 @@ import com.google.gerrit.common.errors.NoSuchGroupException;
|
||||
import com.google.gerrit.extensions.registration.DynamicMap;
|
||||
import com.google.gerrit.extensions.restapi.AcceptsCreate;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.BadRequestException;
|
||||
import com.google.gerrit.extensions.restapi.IdString;
|
||||
import com.google.gerrit.extensions.restapi.NeedsParams;
|
||||
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
|
||||
@@ -69,7 +70,13 @@ public class GroupsCollection implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParams(Multimap<String, String> params) {
|
||||
public void setParams(Multimap<String, String> params)
|
||||
throws BadRequestException {
|
||||
if (params.containsKey("query") && params.containsKey("query2")) {
|
||||
throw new BadRequestException(
|
||||
"\"query\" and \"query2\" options are mutually exclusive");
|
||||
}
|
||||
|
||||
// The --query2 option is defined in QueryGroups
|
||||
this.hasQuery2 = params.containsKey("query2");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user