Remove declarations of unthrown IOException
Change-Id: I528f42db1136022073a4e9cac368ea4cfcddd79f
This commit is contained in:
@@ -363,7 +363,7 @@ public abstract class AbstractDaemonTest {
|
|||||||
initSsh();
|
initSsh();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void evictAndReindexAccount(Account.Id accountId) throws IOException {
|
protected void evictAndReindexAccount(Account.Id accountId) {
|
||||||
accountCache.evict(accountId);
|
accountCache.evict(accountId);
|
||||||
accountIndexer.index(accountId);
|
accountIndexer.index(accountId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ import com.google.gerrit.server.account.ProjectWatches.NotifyType;
|
|||||||
import com.google.gerrit.testing.FakeEmailSender;
|
import com.google.gerrit.testing.FakeEmailSender;
|
||||||
import com.google.gerrit.testing.FakeEmailSender.Message;
|
import com.google.gerrit.testing.FakeEmailSender.Message;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@@ -335,7 +334,7 @@ public abstract class AbstractNotificationTest extends AbstractDaemonTest {
|
|||||||
return description.getClassName();
|
return description.getClassName();
|
||||||
}
|
}
|
||||||
|
|
||||||
private TestAccount evictAndCopy(TestAccount account) throws IOException {
|
private TestAccount evictAndCopy(TestAccount account) {
|
||||||
evictAndReindexAccount(account.id());
|
evictAndReindexAccount(account.id());
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ public class ProjectResetter implements AutoCloseable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Evict groups that were modified. */
|
/** Evict groups that were modified. */
|
||||||
private void evictAndReindexGroups() throws IOException {
|
private void evictAndReindexGroups() {
|
||||||
if (groupCache != null || groupIndexer != null) {
|
if (groupCache != null || groupIndexer != null) {
|
||||||
Set<AccountGroup.UUID> modifiedGroups =
|
Set<AccountGroup.UUID> modifiedGroups =
|
||||||
new HashSet<>(groupUUIDs(restoredRefsByProject.get(allUsersName)));
|
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) {
|
if (accountCache != null) {
|
||||||
accountCache.evict(accountId);
|
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) {
|
if (groupCache != null) {
|
||||||
groupCache.evict(uuid);
|
groupCache.evict(uuid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import com.google.inject.Inject;
|
|||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.Module;
|
import com.google.inject.Module;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -114,7 +113,7 @@ public class Reindex extends SiteProgram {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean reindex() throws IOException {
|
private boolean reindex() {
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
for (IndexDefinition<?, ?, ?> def : indexDefs) {
|
for (IndexDefinition<?, ?, ?> def : indexDefs) {
|
||||||
if (indices.isEmpty() || indices.contains(def.getName())) {
|
if (indices.isEmpty() || indices.contains(def.getName())) {
|
||||||
@@ -186,8 +185,7 @@ public class Reindex extends SiteProgram {
|
|||||||
globalConfig.setBoolean("index", null, "autoReindexIfStale", false);
|
globalConfig.setBoolean("index", null, "autoReindexIfStale", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private <K, V, I extends Index<K, V>> boolean reindex(IndexDefinition<K, V, I> def)
|
private <K, V, I extends Index<K, V>> boolean reindex(IndexDefinition<K, V, I> def) {
|
||||||
throws IOException {
|
|
||||||
I index = def.getIndexCollection().getSearchIndex();
|
I index = def.getIndexCollection().getSearchIndex();
|
||||||
requireNonNull(
|
requireNonNull(
|
||||||
index, () -> String.format("no active search index configured for %s", def.getName()));
|
index, () -> String.format("no active search index configured for %s", def.getName()));
|
||||||
|
|||||||
@@ -616,7 +616,7 @@ public class ChangeEditModifier {
|
|||||||
return user.newRefLogIdent(timestamp, tz);
|
return user.newRefLogIdent(timestamp, tz);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reindex(Change change) throws IOException {
|
private void reindex(Change change) {
|
||||||
indexer.index(change);
|
indexer.index(change);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ public class GroupsUpdate {
|
|||||||
allUsersName, batchRefUpdate, currentUser.map(user -> user.state()).orElse(null));
|
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());
|
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.
|
// By UUID is used for the index and hence should be evicted before refreshing the index.
|
||||||
groupCache.evict(createdGroup.getGroupUUID());
|
groupCache.evict(createdGroup.getGroupUUID());
|
||||||
@@ -448,7 +448,7 @@ public class GroupsUpdate {
|
|||||||
createdGroup.getSubgroups().forEach(groupIncludeCache::evictParentGroupsOf);
|
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());
|
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.
|
// By UUID is used for the index and hence should be evicted before refreshing the index.
|
||||||
groupCache.evict(result.getGroupUuid());
|
groupCache.evict(result.getGroupUuid());
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class StalenessChecker {
|
|||||||
this.indexConfig = indexConfig;
|
this.indexConfig = indexConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStale(Change.Id id) throws IOException {
|
public boolean isStale(Change.Id id) {
|
||||||
ChangeIndex i = indexes.getSearchIndex();
|
ChangeIndex i = indexes.getSearchIndex();
|
||||||
if (i == null) {
|
if (i == null) {
|
||||||
return false; // No index; caller couldn't do anything if it is stale.
|
return false; // No index; caller couldn't do anything if it is stale.
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ import com.google.gerrit.reviewdb.client.Project;
|
|||||||
import com.google.gerrit.reviewdb.client.RefNames;
|
import com.google.gerrit.reviewdb.client.RefNames;
|
||||||
import com.google.gerrit.server.project.ProjectCache;
|
import com.google.gerrit.server.project.ProjectCache;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class StalenessChecker {
|
public class StalenessChecker {
|
||||||
@@ -48,7 +47,7 @@ public class StalenessChecker {
|
|||||||
this.indexConfig = indexConfig;
|
this.indexConfig = indexConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStale(Project.NameKey project) throws IOException {
|
public boolean isStale(Project.NameKey project) {
|
||||||
ProjectData projectData = projectCache.get(project).toProjectData();
|
ProjectData projectData = projectCache.get(project).toProjectData();
|
||||||
ProjectIndex i = indexes.getSearchIndex();
|
ProjectIndex i = indexes.getSearchIndex();
|
||||||
if (i == null) {
|
if (i == null) {
|
||||||
|
|||||||
@@ -204,7 +204,7 @@ public class SchemaCreatorImpl implements SchemaCreator {
|
|||||||
return metaDataUpdate;
|
return metaDataUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void index(InternalGroup group) throws IOException {
|
private void index(InternalGroup group) {
|
||||||
for (GroupIndex groupIndex : indexCollection.getWriteIndexes()) {
|
for (GroupIndex groupIndex : indexCollection.getWriteIndexes()) {
|
||||||
groupIndex.replace(group);
|
groupIndex.replace(group);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ import com.google.gerrit.server.index.IndexModule.IndexType;
|
|||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Key;
|
import com.google.inject.Key;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import org.eclipse.jgit.lib.Config;
|
import org.eclipse.jgit.lib.Config;
|
||||||
@@ -48,7 +47,7 @@ public final class ElasticTestUtils {
|
|||||||
configure(config, port, prefix, null);
|
configure(config, port, prefix, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void createAllIndexes(Injector injector) throws IOException {
|
public static void createAllIndexes(Injector injector) {
|
||||||
Collection<IndexDefinition<?, ?, ?>> indexDefs =
|
Collection<IndexDefinition<?, ?, ?>> indexDefs =
|
||||||
injector.getInstance(Key.get(new TypeLiteral<Collection<IndexDefinition<?, ?, ?>>>() {}));
|
injector.getInstance(Key.get(new TypeLiteral<Collection<IndexDefinition<?, ?, ?>>>() {}));
|
||||||
for (IndexDefinition<?, ?, ?> indexDef : indexDefs) {
|
for (IndexDefinition<?, ?, ?> indexDef : indexDefs) {
|
||||||
|
|||||||
Reference in New Issue
Block a user