Remove declarations of unthrown IOException

Change-Id: I528f42db1136022073a4e9cac368ea4cfcddd79f
This commit is contained in:
David Pursehouse
2019-04-19 17:21:18 +09:00
parent e31ef27060
commit da60dea284
10 changed files with 14 additions and 19 deletions

View File

@@ -363,7 +363,7 @@ public abstract class AbstractDaemonTest {
initSsh();
}
protected void evictAndReindexAccount(Account.Id accountId) throws IOException {
protected void evictAndReindexAccount(Account.Id accountId) {
accountCache.evict(accountId);
accountIndexer.index(accountId);
}

View File

@@ -43,7 +43,6 @@ import com.google.gerrit.server.account.ProjectWatches.NotifyType;
import com.google.gerrit.testing.FakeEmailSender;
import com.google.gerrit.testing.FakeEmailSender.Message;
import com.google.inject.Inject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -335,7 +334,7 @@ public abstract class AbstractNotificationTest extends AbstractDaemonTest {
return description.getClassName();
}
private TestAccount evictAndCopy(TestAccount account) throws IOException {
private TestAccount evictAndCopy(TestAccount account) {
evictAndReindexAccount(account.id());
return account;
}

View File

@@ -353,7 +353,7 @@ public class ProjectResetter implements AutoCloseable {
}
/** Evict groups that were modified. */
private void evictAndReindexGroups() throws IOException {
private void evictAndReindexGroups() {
if (groupCache != null || groupIndexer != null) {
Set<AccountGroup.UUID> modifiedGroups =
new HashSet<>(groupUUIDs(restoredRefsByProject.get(allUsersName)));
@@ -367,7 +367,7 @@ public class ProjectResetter implements AutoCloseable {
}
}
private void evictAndReindexAccount(Account.Id accountId) throws IOException {
private void evictAndReindexAccount(Account.Id accountId) {
if (accountCache != null) {
accountCache.evict(accountId);
}
@@ -379,7 +379,7 @@ public class ProjectResetter implements AutoCloseable {
}
}
private void evictAndReindexGroup(AccountGroup.UUID uuid) throws IOException {
private void evictAndReindexGroup(AccountGroup.UUID uuid) {
if (groupCache != null) {
groupCache.evict(uuid);
}

View File

@@ -38,7 +38,6 @@ import com.google.inject.Inject;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -114,7 +113,7 @@ public class Reindex extends SiteProgram {
return true;
}
private boolean reindex() throws IOException {
private boolean reindex() {
boolean ok = true;
for (IndexDefinition<?, ?, ?> def : indexDefs) {
if (indices.isEmpty() || indices.contains(def.getName())) {
@@ -186,8 +185,7 @@ public class Reindex extends SiteProgram {
globalConfig.setBoolean("index", null, "autoReindexIfStale", false);
}
private <K, V, I extends Index<K, V>> boolean reindex(IndexDefinition<K, V, I> def)
throws IOException {
private <K, V, I extends Index<K, V>> boolean reindex(IndexDefinition<K, V, I> def) {
I index = def.getIndexCollection().getSearchIndex();
requireNonNull(
index, () -> String.format("no active search index configured for %s", def.getName()));

View File

@@ -616,7 +616,7 @@ public class ChangeEditModifier {
return user.newRefLogIdent(timestamp, tz);
}
private void reindex(Change change) throws IOException {
private void reindex(Change change) {
indexer.index(change);
}
}

View File

@@ -435,7 +435,7 @@ public class GroupsUpdate {
allUsersName, batchRefUpdate, currentUser.map(user -> user.state()).orElse(null));
}
private void evictCachesOnGroupCreation(InternalGroup createdGroup) throws IOException {
private void evictCachesOnGroupCreation(InternalGroup createdGroup) {
logger.atFine().log("evict caches on creation of group %s", createdGroup.getGroupUUID());
// By UUID is used for the index and hence should be evicted before refreshing the index.
groupCache.evict(createdGroup.getGroupUUID());
@@ -448,7 +448,7 @@ public class GroupsUpdate {
createdGroup.getSubgroups().forEach(groupIncludeCache::evictParentGroupsOf);
}
private void evictCachesOnGroupUpdate(UpdateResult result) throws IOException {
private void evictCachesOnGroupUpdate(UpdateResult result) {
logger.atFine().log("evict caches on update of group %s", result.getGroupUuid());
// By UUID is used for the index and hence should be evicted before refreshing the index.
groupCache.evict(result.getGroupUuid());

View File

@@ -68,7 +68,7 @@ public class StalenessChecker {
this.indexConfig = indexConfig;
}
public boolean isStale(Change.Id id) throws IOException {
public boolean isStale(Change.Id id) {
ChangeIndex i = indexes.getSearchIndex();
if (i == null) {
return false; // No index; caller couldn't do anything if it is stale.

View File

@@ -29,7 +29,6 @@ import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.server.project.ProjectCache;
import com.google.inject.Inject;
import java.io.IOException;
import java.util.Optional;
public class StalenessChecker {
@@ -48,7 +47,7 @@ public class StalenessChecker {
this.indexConfig = indexConfig;
}
public boolean isStale(Project.NameKey project) throws IOException {
public boolean isStale(Project.NameKey project) {
ProjectData projectData = projectCache.get(project).toProjectData();
ProjectIndex i = indexes.getSearchIndex();
if (i == null) {

View File

@@ -204,7 +204,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
return metaDataUpdate;
}
private void index(InternalGroup group) throws IOException {
private void index(InternalGroup group) {
for (GroupIndex groupIndex : indexCollection.getWriteIndexes()) {
groupIndex.replace(group);
}

View File

@@ -19,7 +19,6 @@ import com.google.gerrit.server.index.IndexModule.IndexType;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;
import java.io.IOException;
import java.util.Collection;
import java.util.UUID;
import org.eclipse.jgit.lib.Config;
@@ -48,7 +47,7 @@ public final class ElasticTestUtils {
configure(config, port, prefix, null);
}
public static void createAllIndexes(Injector injector) throws IOException {
public static void createAllIndexes(Injector injector) {
Collection<IndexDefinition<?, ?, ?>> indexDefs =
injector.getInstance(Key.get(new TypeLiteral<Collection<IndexDefinition<?, ?, ?>>>() {}));
for (IndexDefinition<?, ?, ?> indexDef : indexDefs) {