Merge PerformRenameGroup into PutName

The PutName class is the only user of the PerformRenameGroup
class. This additional indirection is not needed and the pattern of
having a Perform* class to encapsule common logic between SSH and UI
was given up in favor of having this common code in the REST API
implementation classes.

Having all the functionality in PutName avoids to do validation
checks twice and to convert exceptions.

Change-Id: I695ce026be88c7012f1cf6536f34f8c99ea7d405
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-04-09 11:09:32 +02:00
parent 32ffb7b6eb
commit 2785e0a64d
4 changed files with 86 additions and 136 deletions

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.sshd.commands;
import com.google.gerrit.common.errors.NoSuchGroupException;
import com.google.gerrit.extensions.restapi.IdString;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.extensions.restapi.TopLevelResource;
@@ -49,7 +50,7 @@ public class RenameGroupCommand extends SshCommand {
PutName.Input input = new PutName.Input();
input.name = newGroupName;
putName.apply(rsrc, input);
} catch (RestApiException | OrmException e) {
} catch (RestApiException | OrmException | NoSuchGroupException e) {
throw die(e);
}
}