Remove unnecessary "throws" declarations

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=201058582
This commit is contained in:
mcilwain 2018-06-18 14:25:42 -07:00 committed by Ben McIlwain
parent a7256f5edd
commit 5d80f124ca
377 changed files with 2297 additions and 2373 deletions

View file

@ -63,7 +63,7 @@ final class AllocateDomainCommand extends MutatingEppToolCommand {
private final List<Key<DomainApplication>> applicationKeys = new ArrayList<>();
@Override
protected String postExecute() throws Exception {
protected String postExecute() {
return ofy()
.transactNewReadOnly(
() -> {

View file

@ -65,7 +65,7 @@ class AppEngineConnection implements Connection {
memoize(() -> xsrfTokenManager.generateToken(getUserId()));
@Override
public void prefetchXsrfToken() throws IOException {
public void prefetchXsrfToken() {
// Cause XSRF token to be fetched, and then stay resident in cache (since it's memoized).
xsrfToken.get();
}

View file

@ -34,7 +34,7 @@ public class CheckSnapshotCommand implements RemoteApiCommand {
private String snapshotName;
@Override
public void run() throws Exception {
public void run() {
Iterable<DatastoreBackupInfo> backups =
DatastoreBackupService.get().findAllByNamePrefix(snapshotName);
if (Iterables.isEmpty(backups)) {

View file

@ -22,7 +22,7 @@ import java.io.File;
/** Compare two database backups. */
class CompareDbBackups {
public static void main(String[] args) throws Exception {
public static void main(String[] args) {
if (args.length != 2) {
System.err.println("Usage: compare_db_backups <directory1> <directory2>");
return;

View file

@ -71,7 +71,7 @@ public abstract class ConfirmingCommand implements Command {
* Perform any post-execution steps (e.g. verifying the result), and return a description String
* to be printed if non-empty.
*/
protected String postExecute() throws Exception {
protected String postExecute() {
return "";
}

View file

@ -21,7 +21,6 @@ import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import com.google.common.base.Ascii;
import google.registry.util.Idn;
import java.io.IOException;
import java.util.List;
/** Command to convert IDN labels to/from punycode. */
@ -34,7 +33,7 @@ final class ConvertIdnCommand implements Command {
private List<String> mainParameters;
@Override
public void run() throws IOException {
public void run() {
for (String label : mainParameters) {
if (label.startsWith(ACE_PREFIX)) {
System.out.println(Idn.toUnicode(Ascii.toLowerCase(label)));

View file

@ -62,7 +62,7 @@ class CreateCdnsTld extends ConfirmingCommand {
private ManagedZone managedZone;
@Override
protected void init() throws IOException, GeneralSecurityException {
protected void init() {
managedZone =
new ManagedZone()
.setDescription(description)

View file

@ -56,7 +56,7 @@ final class CreateCreditBalanceCommand extends MutatingCommand {
private DateTime effectiveTime;
@Override
public void init() throws Exception {
public void init() {
Registrar registrar =
checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar %s not found", clientId);

View file

@ -68,7 +68,7 @@ final class CreateCreditCommand extends MutatingCommand {
private DateTime effectiveTime;
@Override
protected void init() throws Exception {
protected void init() {
DateTime now = DateTime.now(UTC);
Registrar registrar =
checkArgumentPresent(

View file

@ -81,7 +81,7 @@ abstract class CreateOrUpdatePremiumListCommand extends ConfirmingCommand
}
@Override
protected String prompt() throws Exception {
protected String prompt() {
return String.format(
"You are about to save the premium list %s with %d items: ", name, inputLineCount);
}

View file

@ -272,7 +272,7 @@ abstract class CreateOrUpdateRegistrarCommand extends MutatingCommand {
@Nullable
abstract Registrar getOldRegistrar(String clientId);
protected void initRegistrarCommand() throws Exception {}
protected void initRegistrarCommand() {}
@Override
protected final void init() throws Exception {

View file

@ -269,7 +269,7 @@ abstract class CreateOrUpdateTldCommand extends MutatingCommand {
/** Subclasses can override this to assert that the command can be run in this environment. */
void assertAllowedEnvironment() {}
protected abstract void initTldCommand() throws Exception;
protected abstract void initTldCommand();
@Override
protected final void init() throws Exception {

View file

@ -58,7 +58,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
}
@Override
protected void initRegistrarCommand() throws Exception {
protected void initRegistrarCommand() {
checkArgument(mainParameters.size() == 1, "Must specify exactly one client identifier.");
checkArgumentNotNull(emptyToNull(password), "--password is a required field");
checkArgumentNotNull(registrarName, "--name is a required field");
@ -95,7 +95,7 @@ final class CreateRegistrarCommand extends CreateOrUpdateRegistrarCommand
}
@Override
protected String postExecute() throws Exception {
protected String postExecute() {
if (!createGoogleGroups) {
return "";
}

View file

@ -49,7 +49,7 @@ public class CreateRegistrarGroupsCommand extends ConfirmingCommand
}
@Override
protected void init() throws IOException {
protected void init() {
for (String clientId : clientIds) {
Registrar registrar =
checkArgumentPresent(

View file

@ -53,7 +53,7 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
private Money initialRenewBillingCost;
@Override
protected void initTldCommand() throws Exception {
protected void initTldCommand() {
checkArgument(initialTldState == null || tldStateTransitions.isEmpty(),
"Don't pass both --initial_tld_state and --tld_state_transitions");
checkArgument(initialRenewBillingCost == null || renewBillingCostTransitions.isEmpty(),

View file

@ -41,7 +41,7 @@ final class DeleteCreditCommand extends MutatingCommand {
private long creditId;
@Override
protected void init() throws Exception {
protected void init() {
Registrar registrar =
checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar %s not found", clientId);

View file

@ -43,7 +43,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote
private String name;
@Override
protected void init() throws Exception {
protected void init() {
checkArgument(
doesPremiumListExist(name),
"Cannot delete the premium list %s because it doesn't exist.",
@ -62,7 +62,7 @@ final class DeletePremiumListCommand extends ConfirmingCommand implements Remote
}
@Override
protected String execute() throws Exception {
protected String execute() {
deletePremiumList(premiumList);
return String.format("Deleted premium list '%s'.\n", premiumList.getName());
}

View file

@ -36,7 +36,7 @@ final class DeleteReservedListCommand extends MutatingCommand {
private String name;
@Override
protected void init() throws Exception {
protected void init() {
checkArgument(
ReservedList.get(name).isPresent(),
"Cannot delete the reserved list %s because it doesn't exist.",

View file

@ -52,7 +52,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma
* accidental deletion of established TLDs with domains on them.
*/
@Override
protected void init() throws Exception {
protected void init() {
registry = Registry.get(tld);
checkState(registry.getTldType().equals(TldType.TEST), "Cannot delete a real TLD");
@ -77,7 +77,7 @@ final class DeleteTldCommand extends ConfirmingCommand implements RemoteApiComma
}
@Override
protected String execute() throws Exception {
protected String execute() {
ofy().transactNew(new VoidWork() {
@Override
public void vrun() {

View file

@ -25,7 +25,7 @@ public class DeployInvoicingPipelineCommand implements Command {
@Inject InvoicingPipeline invoicingPipeline;
@Override
public void run() throws Exception {
public void run() {
invoicingPipeline.deploy();
}
}

View file

@ -72,7 +72,7 @@ public class GenerateAllocationTokensCommand implements RemoteApiCommand {
private static final int BATCH_SIZE = 20;
@Override
public void run() throws Exception {
public void run() {
int tokensSaved = 0;
do {
ImmutableSet<AllocationToken> tokens =

View file

@ -79,7 +79,7 @@ final class GenerateEscrowDepositCommand implements RemoteApiCommand {
@Inject @Named("rde-report") Queue queue;
@Override
public void run() throws Exception {
public void run() {
if (tlds.isEmpty()) {
throw new ParameterException("At least one TLD must be specified");

View file

@ -47,7 +47,7 @@ public final class GetLrpTokenCommand implements RemoteApiCommand {
private boolean includeHistory = false;
@Override
public void run() throws Exception {
public void run() {
checkArgument(
(tokenString == null) == (assignee != null),
"Exactly one of either token or assignee must be specified.");

View file

@ -21,7 +21,7 @@ import google.registry.model.SchemaVersion;
@Parameters(commandDescription = "Generate a model schema file")
final class GetSchemaCommand implements Command {
@Override
public void run() throws Exception {
public void run() {
System.out.println(SchemaVersion.getSchema());
}
}

View file

@ -51,7 +51,7 @@ final class GetSchemaTreeCommand implements Command {
private Multimap<Class<?>, Class<?>> superclassToSubclasses;
@Override
public void run() throws Exception {
public void run() {
// Get the @Parent type for each class.
Map<Class<?>, Class<?>> entityToParentType = new HashMap<>();
for (Class<?> clazz : ALL_CLASSES) {

View file

@ -36,7 +36,7 @@ final class HelpCommand implements Command {
private List<String> mainParameters = new ArrayList<>();
@Override
public void run() throws Exception {
public void run() {
String target = getOnlyElement(mainParameters, null);
if (target == null) {
jcommander.usage();

View file

@ -49,7 +49,7 @@ final class ListCursorsCommand implements RemoteApiCommand {
private boolean filterEscrowEnabled;
@Override
public void run() throws Exception {
public void run() {
List<String> lines = new ArrayList<>();
for (String tld : Registries.getTlds()) {
Registry registry = Registry.get(tld);

View file

@ -84,7 +84,7 @@ class LoadTestCommand extends ConfirmingCommand implements ServerSideCommand {
}
@Override
protected boolean checkExecutionState() throws Exception {
protected boolean checkExecutionState() {
if (RegistryToolEnvironment.get() == RegistryToolEnvironment.PRODUCTION) {
System.err.println("You may not run a load test against production.");
return false;

View file

@ -41,7 +41,7 @@ public class LockDomainCommand extends LockOrUnlockDomainCommand {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Override
protected void initMutatingEppToolCommand() throws Exception {
protected void initMutatingEppToolCommand() {
// Project all domains as of the same time so that argument order doesn't affect behavior.
DateTime now = DateTime.now(UTC);
for (String domain : getDomains()) {

View file

@ -30,7 +30,7 @@ public abstract class MutatingEppToolCommand extends EppToolCommand {
boolean dryRun;
@Override
protected boolean checkExecutionState() throws Exception {
protected boolean checkExecutionState() {
checkArgument(!(force && isDryRun()), "--force and --dry_run are incompatible");
return true;
}

View file

@ -43,7 +43,7 @@ final class PendingEscrowCommand implements RemoteApiCommand {
PendingDepositChecker checker;
@Override
public void run() throws Exception {
public void run() {
System.out.println(
SORTER
.sortedCopy(checker.getTldsAndWatermarksPendingDepositForRdeAndBrda().values())

View file

@ -41,7 +41,7 @@ public final class ResaveEntitiesCommand extends MutatingCommand {
List<String> mainParameters;
@Override
protected void init() throws Exception {
protected void init() {
for (List<String> batch : partition(mainParameters, BATCH_SIZE)) {
for (String websafeKey : batch) {
ImmutableObject entity = ofy().load().key(Key.<ImmutableObject>create(websafeKey)).now();

View file

@ -37,7 +37,7 @@ final class ResaveEnvironmentEntitiesCommand implements RemoteApiCommand {
private static final int BATCH_SIZE = 10;
@Override
public void run() throws Exception {
public void run() {
batchSave(Registry.class);
batchSave(Registrar.class);
batchSave(RegistrarContact.class);

View file

@ -47,7 +47,7 @@ public final class ResaveEppResourceCommand extends MutatingCommand {
protected String uniqueId;
@Override
protected void init() throws Exception {
protected void init() {
Key<? extends EppResource> resourceKey = checkArgumentNotNull(
type.getKey(uniqueId, DateTime.now(UTC)),
"Could not find active resource of type %s: %s", type, uniqueId);

View file

@ -25,7 +25,7 @@ interface ServerSideCommand extends RemoteApiCommand {
/** An http connection to AppEngine. */
interface Connection {
void prefetchXsrfToken() throws IOException;
void prefetchXsrfToken();
String send(String endpoint, Map<String, ?> params, MediaType contentType, byte[] payload)
throws IOException;

View file

@ -221,7 +221,7 @@ final class SetupOteCommand extends ConfirmingCommand implements RemoteApiComman
}
@Override
protected String prompt() throws Exception {
protected String prompt() {
// Each underlying command will confirm its own operation as well, so just provide
// a summary of the steps in this command.
if (eapOnly) {

View file

@ -248,7 +248,7 @@ public class ShellCommand implements Command {
*
* <p>Dumps the last line of output prior to doing this.
*/
private void emitSuccess() throws IOException {
private void emitSuccess() {
System.out.println(SUCCESS);
System.out.flush();
}
@ -258,7 +258,7 @@ public class ShellCommand implements Command {
*
* <p>Dumps the last line of output prior to doing this.
*/
private void emitFailure(Throwable e) throws IOException {
private void emitFailure(Throwable e) {
System.out.println(
FAILURE
+ e.getClass().getName()

View file

@ -100,7 +100,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
ImmutableSortedSet<String> existingDsData;
@Override
protected void initMutatingEppToolCommand() throws ParseException {
protected void initMutatingEppToolCommand() {
superuser = true;
DateTime now = DateTime.now(UTC);
ImmutableSet<String> newHostsSet = ImmutableSet.copyOf(newHosts);
@ -176,7 +176,7 @@ final class UniformRapidSuspensionCommand extends MutatingEppToolCommand {
}
@Override
protected String postExecute() throws Exception {
protected String postExecute() {
if (undo) {
return "";
}

View file

@ -41,7 +41,7 @@ public class UnlockDomainCommand extends LockOrUnlockDomainCommand {
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
@Override
protected void initMutatingEppToolCommand() throws Exception {
protected void initMutatingEppToolCommand() {
// Project all domains as of the same time so that argument order doesn't affect behavior.
DateTime now = DateTime.now(UTC);
for (String domain : getDomains()) {

View file

@ -65,7 +65,7 @@ final class UpdateApplicationStatusCommand extends MutatingCommand {
private String clientId = "CharlestonRoad";
@Override
protected void init() throws Exception {
protected void init() {
checkArgumentPresent(
Registrar.loadByClientId(clientId), "Registrar with client ID %s not found", clientId);
for (final String applicationId : ids) {

View file

@ -62,7 +62,7 @@ final class UpdateClaimsNoticeCommand implements RemoteApiCommand {
private String acceptedTime;
@Override
public void run() throws Exception {
public void run() {
final LaunchNotice launchNotice = LaunchNotice.create(
tcnId, validatorId, DateTime.parse(expirationTime), DateTime.parse(acceptedTime));

View file

@ -47,7 +47,7 @@ final class UpdateCursorsCommand extends MutatingCommand {
private DateTime newTimestamp;
@Override
protected void init() throws Exception {
protected void init() {
if (isNullOrEmpty(tlds)) {
Cursor cursor = ofy().load().key(Cursor.createGlobalKey(cursorType)).now();
stageEntityChange(cursor, Cursor.createGlobal(cursorType, newTimestamp));

View file

@ -127,7 +127,7 @@ class UpdateTldCommand extends CreateOrUpdateTldCommand {
}
@Override
protected void initTldCommand() throws Exception {
protected void initTldCommand() {
// Due to per-instance caching on Registry, different instances can end up in different TLD
// states at the same time, so --set_current_tld_state should never be used in production.
checkArgument(

View file

@ -51,12 +51,12 @@ final class UploadClaimsListCommand extends ConfirmingCommand implements RemoteA
}
@Override
protected String prompt() throws Exception {
protected String prompt() {
return String.format("\nNew claims list:\n%s", claimsList);
}
@Override
public String execute() throws IOException {
public String execute() {
claimsList.save();
return String.format("Successfully uploaded claims list %s", claimsListFilename);
}

View file

@ -38,7 +38,7 @@ import java.util.Objects;
public class PopulateNullRegistrarFieldsCommand extends MutatingCommand {
@Override
protected void init() throws Exception {
protected void init() {
for (Registrar registrar : ofy().load().type(Registrar.class).ancestor(getCrossTldKey())) {
Builder changeBuilder = registrar.asBuilder();
changeBuilder.setRegistrarName(