Remove StorageException from throws clauses

Change-Id: I48a0169293ddf766fbbd924cb310f9b8dacc58cf
This commit is contained in:
Dave Borowitz
2019-01-15 19:16:44 -08:00
parent a4fe999a75
commit bd856a44ba
386 changed files with 1022 additions and 1607 deletions

View File

@@ -53,7 +53,6 @@ import com.google.gerrit.common.data.Permission;
import com.google.gerrit.common.data.PermissionRange;
import com.google.gerrit.common.data.PermissionRule;
import com.google.gerrit.common.data.PermissionRule.Action;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.GerritApi;
import com.google.gerrit.extensions.api.changes.ReviewInput;
import com.google.gerrit.extensions.api.changes.RevisionApi;
@@ -1087,7 +1086,7 @@ public abstract class AbstractDaemonTest {
.inOrder();
}
protected PatchSet getPatchSet(PatchSet.Id psId) throws StorageException {
protected PatchSet getPatchSet(PatchSet.Id psId) {
return changeDataFactory.create(project, psId.getParentKey()).patchSet(psId);
}
@@ -1416,7 +1415,7 @@ public abstract class AbstractDaemonTest {
}
protected void watch(PushOneCommit.Result r, ProjectWatchInfoConfiguration config)
throws StorageException, RestApiException {
throws RestApiException {
watch(r.getChange().project().get(), config);
}

View File

@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.NoSuchGroupException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.ServerInitiated;
@@ -157,7 +156,7 @@ public class AccountCreator {
}
private void addGroupMember(AccountGroup.UUID groupUuid, Account.Id accountId)
throws StorageException, IOException, NoSuchGroupException, ConfigInvalidException {
throws IOException, NoSuchGroupException, ConfigInvalidException {
InternalGroupUpdate groupUpdate =
InternalGroupUpdate.builder()
.setMemberModification(memberIds -> Sets.union(memberIds, ImmutableSet.of(accountId)))

View File

@@ -24,7 +24,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@@ -334,15 +333,15 @@ public class PushOneCommit {
this.resSubj = subject;
}
public ChangeData getChange() throws StorageException {
public ChangeData getChange() {
return Iterables.getOnlyElement(queryProvider.get().byKeyPrefix(changeId));
}
public PatchSet getPatchSet() throws StorageException {
public PatchSet getPatchSet() {
return getChange().currentPatchSet();
}
public PatchSet.Id getPatchSetId() throws StorageException {
public PatchSet.Id getPatchSetId() {
return getChange().change().currentPatchSetId();
}
@@ -359,8 +358,7 @@ public class PushOneCommit {
}
public void assertChange(
Change.Status expectedStatus, String expectedTopic, TestAccount... expectedReviewers)
throws StorageException {
Change.Status expectedStatus, String expectedTopic, TestAccount... expectedReviewers) {
assertChange(
expectedStatus, expectedTopic, Arrays.asList(expectedReviewers), ImmutableList.of());
}
@@ -369,8 +367,7 @@ public class PushOneCommit {
Change.Status expectedStatus,
String expectedTopic,
List<TestAccount> expectedReviewers,
List<TestAccount> expectedCcs)
throws StorageException {
List<TestAccount> expectedCcs) {
Change c = getChange().change();
assertThat(c.getSubject()).isEqualTo(resSubj);
assertThat(c.getStatus()).isEqualTo(expectedStatus);
@@ -380,8 +377,7 @@ public class PushOneCommit {
}
private void assertReviewers(
Change c, ReviewerStateInternal state, List<TestAccount> expectedReviewers)
throws StorageException {
Change c, ReviewerStateInternal state, List<TestAccount> expectedReviewers) {
Iterable<Account.Id> actualIds =
approvalsUtil.getReviewers(notesFactory.createChecked(c)).byState(state);
assertThat(actualIds)

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.acceptance.testsuite.account;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.ServerInitiated;
import com.google.gerrit.server.account.AccountState;
@@ -68,7 +67,7 @@ public class AccountOperationsImpl implements AccountOperations {
}
private AccountState createAccount(AccountsUpdate.AccountUpdater accountUpdater)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
Account.Id accountId = new Account.Id(seq.nextAccountId());
return accountsUpdate.insert("Create Test Account", accountId, accountUpdater);
}
@@ -146,7 +145,7 @@ public class AccountOperationsImpl implements AccountOperations {
}
private void updateAccount(TestAccountUpdate accountUpdate)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
AccountsUpdate.AccountUpdater accountUpdater =
(account, updateBuilder) -> fillBuilder(updateBuilder, accountUpdate, accountId);
Optional<AccountState> updatedAccount = updateAccount(accountUpdater);
@@ -154,7 +153,7 @@ public class AccountOperationsImpl implements AccountOperations {
}
private Optional<AccountState> updateAccount(AccountsUpdate.AccountUpdater accountUpdater)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
return accountsUpdate.update("Update Test Account", accountId, accountUpdater);
}

View File

@@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.DuplicateKeyException;
import com.google.gerrit.exceptions.NoSuchGroupException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.GerritPersonIdent;
import com.google.gerrit.server.ServerInitiated;
@@ -70,7 +69,7 @@ public class GroupOperationsImpl implements GroupOperations {
}
private AccountGroup.UUID createNewGroup(TestGroupCreation groupCreation)
throws ConfigInvalidException, IOException, StorageException {
throws ConfigInvalidException, IOException {
InternalGroupCreation internalGroupCreation = toInternalGroupCreation(groupCreation);
InternalGroupUpdate internalGroupUpdate = toInternalGroupUpdate(groupCreation);
InternalGroup internalGroup =
@@ -78,8 +77,7 @@ public class GroupOperationsImpl implements GroupOperations {
return internalGroup.getGroupUUID();
}
private InternalGroupCreation toInternalGroupCreation(TestGroupCreation groupCreation)
throws StorageException {
private InternalGroupCreation toInternalGroupCreation(TestGroupCreation groupCreation) {
AccountGroup.Id groupId = new AccountGroup.Id(seq.nextGroupId());
String groupName = groupCreation.name().orElse("group-with-id-" + groupId.get());
AccountGroup.UUID groupUuid = GroupUUID.make(groupName, serverIdent);

View File

@@ -377,16 +377,16 @@ abstract class AbstractElasticIndex<K, V> implements Index<K, V> {
}
@Override
public ResultSet<V> read() throws StorageException {
public ResultSet<V> read() {
return readImpl((doc) -> AbstractElasticIndex.this.fromDocument(doc, opts.fields()));
}
@Override
public ResultSet<FieldBundle> readRaw() throws StorageException {
public ResultSet<FieldBundle> readRaw() {
return readImpl(AbstractElasticIndex.this::toFieldBundle);
}
private <T> ResultSet<T> readImpl(Function<JsonObject, T> mapper) throws StorageException {
private <T> ResultSet<T> readImpl(Function<JsonObject, T> mapper) {
try {
String uri = getURI(index, SEARCH);
Response response =

View File

@@ -156,8 +156,7 @@ public class GerritPublicKeyChecker extends PublicKeyChecker {
return CheckResult.bad(missingUserIds(allowedUserIds));
}
private CheckResult checkIdsForArbitraryUser(PGPPublicKey key)
throws PGPException, StorageException {
private CheckResult checkIdsForArbitraryUser(PGPPublicKey key) throws PGPException {
List<AccountState> accountStates = accountQueryProvider.get().byExternalId(toExtIdKey(key));
if (accountStates.isEmpty()) {
return CheckResult.bad("Key is not associated with any users");

View File

@@ -18,7 +18,6 @@ import static com.google.gerrit.gpg.PublicKeyStore.keyIdToString;
import static com.google.gerrit.server.account.externalids.ExternalId.SCHEME_GPGKEY;
import com.google.common.io.BaseEncoding;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.common.Input;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
@@ -63,7 +62,7 @@ public class DeleteGpgKey implements RestModifyView<GpgKey, Input> {
@Override
public Response<?> apply(GpgKey rsrc, Input input)
throws RestApiException, PGPException, StorageException, IOException, ConfigInvalidException {
throws RestApiException, PGPException, IOException, ConfigInvalidException {
PGPPublicKey key = rsrc.getKeyRing().getPublicKey();
String fingerprint = BaseEncoding.base16().encode(key.getFingerprint());
Optional<ExternalId> extId = externalIds.get(ExternalId.Key.create(SCHEME_GPGKEY, fingerprint));

View File

@@ -21,7 +21,6 @@ import com.google.common.base.CharMatcher;
import com.google.common.collect.ImmutableList;
import com.google.common.flogger.FluentLogger;
import com.google.common.io.BaseEncoding;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.common.GpgKeyInfo;
import com.google.gerrit.extensions.registration.DynamicMap;
import com.google.gerrit.extensions.restapi.AuthException;
@@ -86,7 +85,7 @@ public class GpgKeys implements ChildCollection<AccountResource, GpgKey> {
@Override
public GpgKey parse(AccountResource parent, IdString id)
throws ResourceNotFoundException, PGPException, StorageException, IOException {
throws ResourceNotFoundException, PGPException, IOException {
checkVisible(self, parent);
ExternalId gpgKeyExtId = findGpgKey(id.get(), getGpgExtIds(parent));
@@ -142,7 +141,7 @@ public class GpgKeys implements ChildCollection<AccountResource, GpgKey> {
public class ListGpgKeys implements RestReadView<AccountResource> {
@Override
public Map<String, GpgKeyInfo> apply(AccountResource rsrc)
throws StorageException, PGPException, IOException, ResourceNotFoundException {
throws PGPException, IOException, ResourceNotFoundException {
checkVisible(self, rsrc);
Map<String, GpgKeyInfo> keys = new HashMap<>();
try (PublicKeyStore store = storeProvider.get()) {

View File

@@ -27,7 +27,6 @@ import com.google.common.collect.Maps;
import com.google.common.flogger.FluentLogger;
import com.google.common.io.BaseEncoding;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.accounts.GpgKeysInput;
import com.google.gerrit.extensions.common.GpgKeyInfo;
import com.google.gerrit.extensions.restapi.BadRequestException;
@@ -108,7 +107,7 @@ public class PostGpgKeys implements RestModifyView<AccountResource, GpgKeysInput
@Override
public Map<String, GpgKeyInfo> apply(AccountResource rsrc, GpgKeysInput input)
throws ResourceNotFoundException, BadRequestException, ResourceConflictException,
PGPException, StorageException, IOException, ConfigInvalidException {
PGPException, IOException, ConfigInvalidException {
GpgKeys.checkVisible(self, rsrc);
Collection<ExternalId> existingExtIds =
@@ -249,7 +248,7 @@ public class PostGpgKeys implements RestModifyView<AccountResource, GpgKeysInput
return ExternalId.Key.create(SCHEME_GPGKEY, BaseEncoding.base16().encode(fp));
}
private Account getAccountByExternalId(ExternalId.Key extIdKey) throws StorageException {
private Account getAccountByExternalId(ExternalId.Key extIdKey) {
List<AccountState> accountStates = accountQueryProvider.get().byExternalId(extIdKey);
if (accountStates.isEmpty()) {

View File

@@ -152,7 +152,7 @@ class HttpLoginServlet extends HttpServlet {
}
private void updateRemoteExternalId(AuthResult arsp, String remoteAuthToken)
throws AccountException, StorageException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
accountManager.updateLink(
arsp.getAccountId(),
new AuthRequest(ExternalId.Key.create(SCHEME_EXTERNAL, remoteAuthToken)));

View File

@@ -62,7 +62,7 @@ public final class FieldDef<I, T> {
@FunctionalInterface
public interface Getter<I, T> {
@Nullable
T get(I input) throws StorageException, IOException;
T get(I input) throws IOException;
}
public static class Builder<T> {
@@ -133,10 +133,9 @@ public final class FieldDef<I, T> {
*
* @param input input object.
* @return the field value(s) to index.
* @throws StorageException
*/
@Nullable
public T get(I input) throws StorageException {
public T get(I input) {
try {
return getter.get(input);
} catch (IOException e) {

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.index.query;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -82,7 +81,7 @@ public class AndPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(T object) throws StorageException {
public boolean match(T object) {
for (Predicate<T> c : children) {
checkState(
c.isMatchable(),

View File

@@ -74,7 +74,7 @@ public class AndSource<T> extends AndPredicate<T>
}
@Override
public ResultSet<T> read() throws StorageException {
public ResultSet<T> read() {
if (source == null) {
throw new StorageException("No DataSource: " + this);
}
@@ -123,7 +123,7 @@ public class AndSource<T> extends AndPredicate<T>
}
@Override
public ResultSet<FieldBundle> readRaw() throws StorageException {
public ResultSet<FieldBundle> readRaw() {
// TOOD(hiesel): Implement
throw new UnsupportedOperationException("not implemented");
}
@@ -134,7 +134,7 @@ public class AndSource<T> extends AndPredicate<T>
}
@Override
public boolean match(T object) throws StorageException {
public boolean match(T object) {
if (isVisibleToPredicate != null && !isVisibleToPredicate.match(object)) {
return false;
}

View File

@@ -14,15 +14,13 @@
package com.google.gerrit.index.query;
import com.google.gerrit.exceptions.StorageException;
public interface DataSource<T> {
/** @return an estimate of the number of results from {@link #read()}. */
int getCardinality();
/** @return read from the database and return the results. */
ResultSet<T> read() throws StorageException;
ResultSet<T> read();
/** @return read from the database and return the raw results. */
ResultSet<FieldBundle> readRaw() throws StorageException;
ResultSet<FieldBundle> readRaw();
}

View File

@@ -77,17 +77,17 @@ public class IndexedQuery<I, T> extends Predicate<T> implements DataSource<T>, P
}
@Override
public ResultSet<T> read() throws StorageException {
public ResultSet<T> read() {
return source.read();
}
@Override
public ResultSet<FieldBundle> readRaw() throws StorageException {
public ResultSet<FieldBundle> readRaw() {
return source.readRaw();
}
@Override
public ResultSet<T> restart(int start) throws StorageException {
public ResultSet<T> restart(int start) {
opts = opts.withStart(start);
try {
source = index.getSource(pred, opts);

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.index.query;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.FieldDef;
import com.google.gerrit.index.query.RangeUtil.Range;
@@ -30,9 +29,9 @@ public abstract class IntegerRangePredicate<T> extends IndexPredicate<T> {
}
}
protected abstract Integer getValueInt(T object) throws StorageException;
protected abstract Integer getValueInt(T object);
public boolean match(T object) throws StorageException {
public boolean match(T object) {
Integer valueInt = getValueInt(object);
if (valueInt == null) {
return false;

View File

@@ -88,11 +88,11 @@ public class InternalQuery<T, Q extends InternalQuery<T, Q>> {
return self();
}
public final List<T> query(Predicate<T> p) throws StorageException {
public final List<T> query(Predicate<T> p) {
return queryResults(p).entities();
}
final QueryResult<T> queryResults(Predicate<T> p) throws StorageException {
final QueryResult<T> queryResults(Predicate<T> p) {
try {
return queryProcessor.query(p);
} catch (QueryParseException e) {
@@ -110,7 +110,7 @@ public class InternalQuery<T, Q extends InternalQuery<T, Q>> {
* @return results of the queries, one list of results per input query, in the same order as the
* input.
*/
public final List<List<T>> query(List<Predicate<T>> queries) throws StorageException {
public final List<List<T>> query(List<Predicate<T>> queries) {
try {
return Lists.transform(queryProcessor.query(queries), QueryResult::entities);
} catch (QueryParseException e) {
@@ -144,11 +144,9 @@ public class InternalQuery<T, Q extends InternalQuery<T, Q>> {
* @param predicate predicate to search for.
* @param <T> result type.
* @return exhaustive list of results, subject to the race condition described above.
* @throws StorageException if an error occurred.
*/
protected static <T> ImmutableList<T> queryExhaustively(
Supplier<? extends InternalQuery<T, ?>> querySupplier, Predicate<T> predicate)
throws StorageException {
Supplier<? extends InternalQuery<T, ?>> querySupplier, Predicate<T> predicate) {
ImmutableList.Builder<T> b = null;
int start = 0;
while (true) {

View File

@@ -14,15 +14,9 @@
package com.google.gerrit.index.query;
import com.google.gerrit.exceptions.StorageException;
public interface Matchable<T> {
/**
* Does this predicate match this object?
*
* @throws StorageException
*/
boolean match(T object) throws StorageException;
/** Does this predicate match this object? */
boolean match(T object);
/** @return a cost estimate to run this predicate, higher figures cost more. */
int getCost();

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.index.query;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -64,7 +63,7 @@ public class NotPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(T object) throws StorageException {
public boolean match(T object) {
checkState(
that.isMatchable(),
"match invoked, but child predicate %s doesn't implement %s",

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.index.query;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -82,7 +81,7 @@ public class OrPredicate<T> extends Predicate<T> implements Matchable<T> {
}
@Override
public boolean match(T object) throws StorageException {
public boolean match(T object) {
for (Predicate<T> c : children) {
checkState(
c.isMatchable(),

View File

@@ -14,11 +14,10 @@
package com.google.gerrit.index.query;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.QueryOptions;
public interface Paginated<T> {
QueryOptions getOptions();
ResultSet<T> restart(int start) throws StorageException;
ResultSet<T> restart(int start);
}

View File

@@ -172,7 +172,7 @@ public abstract class QueryProcessor<T> {
* @param query the query.
* @return results of the query.
*/
public QueryResult<T> query(Predicate<T> query) throws StorageException, QueryParseException {
public QueryResult<T> query(Predicate<T> query) throws QueryParseException {
return query(ImmutableList.of(query)).get(0);
}
@@ -187,8 +187,7 @@ public abstract class QueryProcessor<T> {
* @return results of the queries, one QueryResult per input query, in the same order as the
* input.
*/
public List<QueryResult<T>> query(List<Predicate<T>> queries)
throws StorageException, QueryParseException {
public List<QueryResult<T>> query(List<Predicate<T>> queries) throws QueryParseException {
try {
return query(null, queries);
} catch (StorageException e) {
@@ -200,8 +199,7 @@ public abstract class QueryProcessor<T> {
}
private List<QueryResult<T>> query(
@Nullable List<String> queryStrings, List<Predicate<T>> queries)
throws StorageException, QueryParseException {
@Nullable List<String> queryStrings, List<Predicate<T>> queries) throws QueryParseException {
long startNanos = System.nanoTime();
checkState(!used.getAndSet(true), "%s has already been used", getClass().getSimpleName());
int cnt = queries.size();

View File

@@ -486,16 +486,16 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
}
@Override
public ResultSet<V> read() throws StorageException {
public ResultSet<V> read() {
return readImpl(AbstractLuceneIndex.this::fromDocument);
}
@Override
public ResultSet<FieldBundle> readRaw() throws StorageException {
public ResultSet<FieldBundle> readRaw() {
return readImpl(AbstractLuceneIndex.this::toFieldBundle);
}
private <T> ResultSet<T> readImpl(Function<Document, T> mapper) throws StorageException {
private <T> ResultSet<T> readImpl(Function<Document, T> mapper) {
IndexSearcher searcher = null;
try {
searcher = acquire();

View File

@@ -302,7 +302,7 @@ public class LuceneChangeIndex implements ChangeIndex {
}
@Override
public ResultSet<ChangeData> read() throws StorageException {
public ResultSet<ChangeData> read() {
if (Thread.interrupted()) {
Thread.currentThread().interrupt();
throw new StorageException("interrupted");
@@ -326,7 +326,7 @@ public class LuceneChangeIndex implements ChangeIndex {
}
@Override
public ResultSet<FieldBundle> readRaw() throws StorageException {
public ResultSet<FieldBundle> readRaw() {
List<Document> documents;
try {
documents = doRead(IndexUtils.changeFields(opts));

View File

@@ -22,7 +22,6 @@ import com.google.common.base.Strings;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Die;
import com.google.gerrit.common.IoUtil;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.metrics.DisabledMetricMaker;
import com.google.gerrit.metrics.MetricMaker;
import com.google.gerrit.pgm.init.api.ConsoleUI;
@@ -350,7 +349,7 @@ public class BaseInit extends SiteProgram {
this.repositoryManager = repositoryManager;
}
void upgradeSchema() throws StorageException {
void upgradeSchema() {
noteDbSchemaUpdater.update(new UpdateUIImpl(ui));
}

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.pgm.init;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.pgm.init.api.AllUsersNameOnInitProvider;
import com.google.gerrit.pgm.init.api.InitFlags;
import com.google.gerrit.server.GerritPersonIdentProvider;
@@ -49,7 +48,7 @@ public class ExternalIdsOnInit {
}
public synchronized void insert(String commitMessage, Collection<ExternalId> extIds)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
File path = getPath();
if (path != null) {
try (Repository allUsersRepo = new FileRepository(path)) {

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.pgm.init.api;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.extensions.events.GitReferenceUpdated;
import com.google.gerrit.server.git.GitRepositoryManager;
@@ -34,7 +33,7 @@ public class SequencesOnInit {
this.allUsersName = allUsersName;
}
public int nextAccountId() throws StorageException {
public int nextAccountId() {
RepoSequence accountSeq =
new RepoSequence(
repoManager,

View File

@@ -73,8 +73,7 @@ public class ApprovalCopier {
}
Iterable<PatchSetApproval> getForPatchSet(
ChangeNotes notes, PatchSet.Id psId, @Nullable RevWalk rw, @Nullable Config repoConfig)
throws StorageException {
ChangeNotes notes, PatchSet.Id psId, @Nullable RevWalk rw, @Nullable Config repoConfig) {
return getForPatchSet(notes, psId, rw, repoConfig, Collections.emptyList());
}
@@ -83,8 +82,7 @@ public class ApprovalCopier {
PatchSet.Id psId,
@Nullable RevWalk rw,
@Nullable Config repoConfig,
Iterable<PatchSetApproval> dontCopy)
throws StorageException {
Iterable<PatchSetApproval> dontCopy) {
PatchSet ps = psUtil.get(notes, psId);
if (ps == null) {
return Collections.emptyList();
@@ -97,8 +95,7 @@ public class ApprovalCopier {
PatchSet ps,
@Nullable RevWalk rw,
@Nullable Config repoConfig,
Iterable<PatchSetApproval> dontCopy)
throws StorageException {
Iterable<PatchSetApproval> dontCopy) {
requireNonNull(ps, "ps should not be null");
ChangeData cd = changeDataFactory.create(notes);
try {
@@ -157,7 +154,7 @@ public class ApprovalCopier {
}
}
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd) throws StorageException {
private static TreeMap<Integer, PatchSet> getPatchSets(ChangeData cd) {
Collection<PatchSet> patchSets = cd.patchSets();
TreeMap<Integer, PatchSet> result = new TreeMap<>();
for (PatchSet ps : patchSets) {

View File

@@ -112,9 +112,8 @@ public class ApprovalsUtil {
*
* @param notes change notes.
* @return reviewers for the change.
* @throws StorageException if reviewers for the change could not be read.
*/
public ReviewerSet getReviewers(ChangeNotes notes) throws StorageException {
public ReviewerSet getReviewers(ChangeNotes notes) {
return notes.load().getReviewers();
}
@@ -123,10 +122,8 @@ public class ApprovalsUtil {
*
* @param allApprovals all approvals to consider; must all belong to the same change.
* @return reviewers for the change.
* @throws StorageException if reviewers for the change could not be read.
*/
public ReviewerSet getReviewers(ChangeNotes notes, Iterable<PatchSetApproval> allApprovals)
throws StorageException {
public ReviewerSet getReviewers(ChangeNotes notes, Iterable<PatchSetApproval> allApprovals) {
return notes.load().getReviewers();
}
@@ -135,9 +132,8 @@ public class ApprovalsUtil {
*
* @param notes change notes.
* @return reviewer updates for the change.
* @throws StorageException if reviewer updates for the change could not be read.
*/
public List<ReviewerStatusUpdate> getReviewerUpdates(ChangeNotes notes) throws StorageException {
public List<ReviewerStatusUpdate> getReviewerUpdates(ChangeNotes notes) {
return notes.load().getReviewerUpdates();
}
@@ -165,8 +161,7 @@ public class ApprovalsUtil {
ChangeUpdate update,
LabelTypes labelTypes,
Change change,
Iterable<Account.Id> wantReviewers)
throws StorageException {
Iterable<Account.Id> wantReviewers) {
PatchSet.Id psId = change.currentPatchSetId();
Collection<Account.Id> existingReviewers;
existingReviewers = notes.load().getReviewers().byState(REVIEWER);
@@ -245,11 +240,9 @@ public class ApprovalsUtil {
* @param update change update.
* @param wantCCs accounts to CC.
* @return whether a change was made.
* @throws StorageException
*/
public Collection<Account.Id> addCcs(
ChangeNotes notes, ChangeUpdate update, Collection<Account.Id> wantCCs)
throws StorageException {
ChangeNotes notes, ChangeUpdate update, Collection<Account.Id> wantCCs) {
return addCcs(update, wantCCs, notes.load().getReviewers());
}
@@ -273,7 +266,6 @@ public class ApprovalsUtil {
* @param user user adding approvals.
* @param approvals approvals to add.
* @throws RestApiException
* @throws StorageException
*/
public Iterable<PatchSetApproval> addApprovalsForNewPatchSet(
ChangeUpdate update,
@@ -281,7 +273,7 @@ public class ApprovalsUtil {
PatchSet ps,
CurrentUser user,
Map<String, Short> approvals)
throws RestApiException, StorageException, PermissionBackendException {
throws RestApiException, PermissionBackendException {
Account.Id accountId = user.getAccountId();
checkArgument(
accountId.equals(ps.getUploader()),
@@ -331,14 +323,12 @@ public class ApprovalsUtil {
}
}
public ListMultimap<PatchSet.Id, PatchSetApproval> byChange(ChangeNotes notes)
throws StorageException {
public ListMultimap<PatchSet.Id, PatchSetApproval> byChange(ChangeNotes notes) {
return notes.load().getApprovals();
}
public Iterable<PatchSetApproval> byPatchSet(
ChangeNotes notes, PatchSet.Id psId, @Nullable RevWalk rw, @Nullable Config repoConfig)
throws StorageException {
ChangeNotes notes, PatchSet.Id psId, @Nullable RevWalk rw, @Nullable Config repoConfig) {
return copier.getForPatchSet(notes, psId, rw, repoConfig);
}
@@ -347,8 +337,7 @@ public class ApprovalsUtil {
PatchSet.Id psId,
Account.Id accountId,
@Nullable RevWalk rw,
@Nullable Config repoConfig)
throws StorageException {
@Nullable Config repoConfig) {
return filterApprovals(byPatchSet(notes, psId, rw, repoConfig), accountId);
}

View File

@@ -18,7 +18,6 @@ import static com.google.common.base.Preconditions.checkState;
import static java.util.Objects.requireNonNull;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.common.ChangeMessageInfo;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.ChangeMessage;
@@ -87,7 +86,7 @@ public class ChangeMessagesUtil {
return workInProgress ? TAG_UPLOADED_WIP_PATCH_SET : TAG_UPLOADED_PATCH_SET;
}
public List<ChangeMessage> byChange(ChangeNotes notes) throws StorageException {
public List<ChangeMessage> byChange(ChangeNotes notes) {
return notes.load().getChangeMessages();
}

View File

@@ -124,7 +124,7 @@ public class CommentsUtil {
String message,
@Nullable Boolean unresolved,
@Nullable String parentUuid)
throws StorageException, UnprocessableEntityException {
throws UnprocessableEntityException {
if (unresolved == null) {
if (parentUuid == null) {
// Default to false if comment is not descended from another.
@@ -175,29 +175,27 @@ public class CommentsUtil {
return c;
}
public Optional<Comment> getPublished(ChangeNotes notes, Comment.Key key)
throws StorageException {
public Optional<Comment> getPublished(ChangeNotes notes, Comment.Key key) {
return publishedByChange(notes).stream().filter(c -> key.equals(c.key)).findFirst();
}
public Optional<Comment> getDraft(ChangeNotes notes, IdentifiedUser user, Comment.Key key)
throws StorageException {
public Optional<Comment> getDraft(ChangeNotes notes, IdentifiedUser user, Comment.Key key) {
return draftByChangeAuthor(notes, user.getAccountId()).stream()
.filter(c -> key.equals(c.key))
.findFirst();
}
public List<Comment> publishedByChange(ChangeNotes notes) throws StorageException {
public List<Comment> publishedByChange(ChangeNotes notes) {
notes.load();
return sort(Lists.newArrayList(notes.getComments().values()));
}
public List<RobotComment> robotCommentsByChange(ChangeNotes notes) throws StorageException {
public List<RobotComment> robotCommentsByChange(ChangeNotes notes) {
notes.load();
return sort(Lists.newArrayList(notes.getRobotComments().values()));
}
public List<Comment> draftByChange(ChangeNotes notes) throws StorageException {
public List<Comment> draftByChange(ChangeNotes notes) {
List<Comment> comments = new ArrayList<>();
for (Ref ref : getDraftRefs(notes.getChangeId())) {
Account.Id account = Account.Id.fromRefSuffix(ref.getName());
@@ -208,7 +206,7 @@ public class CommentsUtil {
return sort(comments);
}
public List<Comment> byPatchSet(ChangeNotes notes, PatchSet.Id psId) throws StorageException {
public List<Comment> byPatchSet(ChangeNotes notes, PatchSet.Id psId) {
List<Comment> comments = new ArrayList<>();
comments.addAll(publishedByPatchSet(notes, psId));
@@ -221,19 +219,16 @@ public class CommentsUtil {
return sort(comments);
}
public List<Comment> publishedByChangeFile(ChangeNotes notes, String file)
throws StorageException {
public List<Comment> publishedByChangeFile(ChangeNotes notes, String file) {
return commentsOnFile(notes.load().getComments().values(), file);
}
public List<Comment> publishedByPatchSet(ChangeNotes notes, PatchSet.Id psId)
throws StorageException {
public List<Comment> publishedByPatchSet(ChangeNotes notes, PatchSet.Id psId) {
return removeCommentsOnAncestorOfCommitMessage(
commentsOnPatchSet(notes.load().getComments().values(), psId));
}
public List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId)
throws StorageException {
public List<RobotComment> robotCommentsByPatchSet(ChangeNotes notes, PatchSet.Id psId) {
return commentsOnPatchSet(notes.load().getRobotComments().values(), psId);
}
@@ -250,18 +245,16 @@ public class CommentsUtil {
.collect(toList());
}
public List<Comment> draftByPatchSetAuthor(PatchSet.Id psId, Account.Id author, ChangeNotes notes)
throws StorageException {
public List<Comment> draftByPatchSetAuthor(
PatchSet.Id psId, Account.Id author, ChangeNotes notes) {
return commentsOnPatchSet(notes.load().getDraftComments(author).values(), psId);
}
public List<Comment> draftByChangeFileAuthor(ChangeNotes notes, String file, Account.Id author)
throws StorageException {
public List<Comment> draftByChangeFileAuthor(ChangeNotes notes, String file, Account.Id author) {
return commentsOnFile(notes.load().getDraftComments(author).values(), file);
}
public List<Comment> draftByChangeAuthor(ChangeNotes notes, Account.Id author)
throws StorageException {
public List<Comment> draftByChangeAuthor(ChangeNotes notes, Account.Id author) {
List<Comment> comments = new ArrayList<>();
comments.addAll(notes.getDraftComments(author).values());
return sort(comments);
@@ -345,7 +338,7 @@ public class CommentsUtil {
* @param changeId change ID.
* @return raw refs from All-Users repo.
*/
public Collection<Ref> getDraftRefs(Change.Id changeId) throws StorageException {
public Collection<Ref> getDraftRefs(Change.Id changeId) {
try (Repository repo = repoManager.openRepository(allUsers)) {
return getDraftRefs(repo, changeId);
} catch (IOException e) {

View File

@@ -22,7 +22,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import com.google.gerrit.common.data.LabelFunction;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSet;
@@ -63,25 +62,24 @@ public class PatchSetUtil {
this.repoManager = repoManager;
}
public PatchSet current(ChangeNotes notes) throws StorageException {
public PatchSet current(ChangeNotes notes) {
return get(notes, notes.getChange().currentPatchSetId());
}
public PatchSet get(ChangeNotes notes, PatchSet.Id psId) throws StorageException {
public PatchSet get(ChangeNotes notes, PatchSet.Id psId) {
return notes.load().getPatchSets().get(psId);
}
public ImmutableCollection<PatchSet> byChange(ChangeNotes notes) throws StorageException {
public ImmutableCollection<PatchSet> byChange(ChangeNotes notes) {
return notes.load().getPatchSets().values();
}
public ImmutableMap<PatchSet.Id, PatchSet> byChangeAsMap(ChangeNotes notes)
throws StorageException {
public ImmutableMap<PatchSet.Id, PatchSet> byChangeAsMap(ChangeNotes notes) {
return notes.load().getPatchSets();
}
public ImmutableMap<PatchSet.Id, PatchSet> getAsMap(
ChangeNotes notes, Set<PatchSet.Id> patchSetIds) throws StorageException {
ChangeNotes notes, Set<PatchSet.Id> patchSetIds) {
return ImmutableMap.copyOf(Maps.filterKeys(notes.load().getPatchSets(), patchSetIds::contains));
}
@@ -136,7 +134,7 @@ public class PatchSetUtil {
/** Check if the current patch set of the change is locked. */
public void checkPatchSetNotLocked(ChangeNotes notes)
throws StorageException, IOException, ResourceConflictException {
throws IOException, ResourceConflictException {
if (isPatchSetLocked(notes)) {
throw new ResourceConflictException(
String.format("The current patch set of change %s is locked", notes.getChangeId()));
@@ -144,7 +142,7 @@ public class PatchSetUtil {
}
/** Is the current patch set locked against state changes? */
public boolean isPatchSetLocked(ChangeNotes notes) throws StorageException, IOException {
public boolean isPatchSetLocked(ChangeNotes notes) throws IOException {
Change change = notes.getChange();
if (change.isMerged()) {
return false;

View File

@@ -46,8 +46,7 @@ public class PublishCommentUtil {
}
public void publish(
ChangeContext ctx, PatchSet.Id psId, Collection<Comment> drafts, @Nullable String tag)
throws StorageException {
ChangeContext ctx, PatchSet.Id psId, Collection<Comment> drafts, @Nullable String tag) {
ChangeNotes notes = ctx.getNotes();
checkArgument(notes != null);
if (drafts.isEmpty()) {

View File

@@ -186,8 +186,7 @@ public class StarredChangesUtil {
this.queryProvider = queryProvider;
}
public ImmutableSortedSet<String> getLabels(Account.Id accountId, Change.Id changeId)
throws StorageException {
public ImmutableSortedSet<String> getLabels(Account.Id accountId, Change.Id changeId) {
try (Repository repo = repoManager.openRepository(allUsers)) {
return readLabels(repo, RefNames.refsStarredChanges(changeId, accountId)).labels();
} catch (IOException e) {
@@ -205,7 +204,7 @@ public class StarredChangesUtil {
Change.Id changeId,
Set<String> labelsToAdd,
Set<String> labelsToRemove)
throws StorageException, IllegalLabelException {
throws IllegalLabelException {
try (Repository repo = repoManager.openRepository(allUsers)) {
String refName = RefNames.refsStarredChanges(changeId, accountId);
StarRef old = readLabels(repo, refName);
@@ -234,7 +233,7 @@ public class StarredChangesUtil {
}
}
public void unstarAll(Project.NameKey project, Change.Id changeId) throws StorageException {
public void unstarAll(Project.NameKey project, Change.Id changeId) {
try (Repository repo = repoManager.openRepository(allUsers);
RevWalk rw = new RevWalk(repo)) {
BatchRefUpdate batchUpdate = repo.getRefDatabase().newBatchUpdate();
@@ -261,7 +260,7 @@ public class StarredChangesUtil {
}
}
public ImmutableMap<Account.Id, StarRef> byChange(Change.Id changeId) throws StorageException {
public ImmutableMap<Account.Id, StarRef> byChange(Change.Id changeId) {
try (Repository repo = repoManager.openRepository(allUsers)) {
ImmutableMap.Builder<Account.Id, StarRef> builder = ImmutableMap.builder();
for (String refPart : getRefNames(repo, RefNames.refsStarredChangesPrefix(changeId))) {
@@ -279,8 +278,7 @@ public class StarredChangesUtil {
}
}
public ImmutableListMultimap<Account.Id, String> byChangeFromIndex(Change.Id changeId)
throws StorageException {
public ImmutableListMultimap<Account.Id, String> byChangeFromIndex(Change.Id changeId) {
List<ChangeData> changeData =
queryProvider
.get()
@@ -311,7 +309,7 @@ public class StarredChangesUtil {
}
}
public void ignore(ChangeResource rsrc) throws StorageException, IllegalLabelException {
public void ignore(ChangeResource rsrc) throws IllegalLabelException {
star(
rsrc.getUser().asIdentifiedUser().getAccountId(),
rsrc.getProject(),
@@ -320,7 +318,7 @@ public class StarredChangesUtil {
ImmutableSet.of());
}
public void unignore(ChangeResource rsrc) throws StorageException, IllegalLabelException {
public void unignore(ChangeResource rsrc) throws IllegalLabelException {
star(
rsrc.getUser().asIdentifiedUser().getAccountId(),
rsrc.getProject(),
@@ -329,11 +327,11 @@ public class StarredChangesUtil {
ImmutableSet.of(IGNORE_LABEL));
}
public boolean isIgnoredBy(Change.Id changeId, Account.Id accountId) throws StorageException {
public boolean isIgnoredBy(Change.Id changeId, Account.Id accountId) {
return getLabels(accountId, changeId).contains(IGNORE_LABEL);
}
public boolean isIgnored(ChangeResource rsrc) throws StorageException {
public boolean isIgnored(ChangeResource rsrc) {
return isIgnoredBy(rsrc.getChange().getId(), rsrc.getUser().asIdentifiedUser().getAccountId());
}
@@ -353,7 +351,7 @@ public class StarredChangesUtil {
return UNREVIEWED_LABEL + "/" + ps;
}
public void markAsReviewed(ChangeResource rsrc) throws StorageException, IllegalLabelException {
public void markAsReviewed(ChangeResource rsrc) throws IllegalLabelException {
star(
rsrc.getUser().asIdentifiedUser().getAccountId(),
rsrc.getProject(),
@@ -362,7 +360,7 @@ public class StarredChangesUtil {
ImmutableSet.of(getUnreviewedLabel(rsrc.getChange())));
}
public void markAsUnreviewed(ChangeResource rsrc) throws StorageException, IllegalLabelException {
public void markAsUnreviewed(ChangeResource rsrc) throws IllegalLabelException {
star(
rsrc.getUser().asIdentifiedUser().getAccountId(),
rsrc.getProject(),
@@ -444,7 +442,7 @@ public class StarredChangesUtil {
private void updateLabels(
Repository repo, String refName, ObjectId oldObjectId, Collection<String> labels)
throws IOException, StorageException, InvalidLabelsException {
throws IOException, InvalidLabelsException {
try (TraceTimer traceTimer =
TraceContext.newTimer("Update star labels in %s (labels=%s)", refName, labels);
RevWalk rw = new RevWalk(repo)) {
@@ -477,8 +475,7 @@ public class StarredChangesUtil {
}
}
private void deleteRef(Repository repo, String refName, ObjectId oldObjectId)
throws IOException, StorageException {
private void deleteRef(Repository repo, String refName, ObjectId oldObjectId) throws IOException {
if (ObjectId.zeroId().equals(oldObjectId)) {
// ref doesn't exist
return;

View File

@@ -214,7 +214,7 @@ public class AccountManager {
}
private void update(AuthRequest who, ExternalId extId)
throws StorageException, IOException, ConfigInvalidException, AccountException {
throws IOException, ConfigInvalidException, AccountException {
IdentifiedUser user = userFactory.create(extId.accountId());
List<Consumer<InternalAccountUpdate.Builder>> accountUpdates = new ArrayList<>();
@@ -271,7 +271,7 @@ public class AccountManager {
}
private AuthResult create(AuthRequest who)
throws StorageException, AccountException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
Account.Id newId = new Account.Id(sequences.nextAccountId());
logger.atFine().log("Assigning new Id %s to account", newId);
@@ -375,7 +375,7 @@ public class AccountManager {
}
private void addGroupMember(AccountGroup.UUID groupUuid, IdentifiedUser user)
throws StorageException, IOException, ConfigInvalidException, AccountException {
throws IOException, ConfigInvalidException, AccountException {
// The user initiated this request by logging in. -> Attribute all modifications to that user.
GroupsUpdate groupsUpdate = groupsUpdateFactory.create(user);
InternalGroupUpdate groupUpdate =
@@ -400,7 +400,7 @@ public class AccountManager {
* this time.
*/
public AuthResult link(Account.Id to, AuthRequest who)
throws AccountException, StorageException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
Optional<ExternalId> optionalExtId = externalIds.get(who.getExternalIdKey());
if (optionalExtId.isPresent()) {
ExternalId extId = optionalExtId.get();
@@ -437,12 +437,11 @@ public class AccountManager {
* @param to account to link the identity onto.
* @param who the additional identity.
* @return the result of linking the identity to the user.
* @throws StorageException
* @throws AccountException the identity belongs to a different account, or it cannot be linked at
* this time.
*/
public AuthResult updateLink(Account.Id to, AuthRequest who)
throws StorageException, AccountException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
accountsUpdateProvider
.get()
.update(
@@ -474,7 +473,7 @@ public class AccountManager {
* found
*/
public void unlink(Account.Id from, ExternalId.Key extIdKey)
throws AccountException, StorageException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
unlink(from, ImmutableList.of(extIdKey));
}
@@ -487,7 +486,7 @@ public class AccountManager {
* identity was not found
*/
public void unlink(Account.Id from, Collection<ExternalId.Key> extIdKeys)
throws AccountException, StorageException, IOException, ConfigInvalidException {
throws AccountException, IOException, ConfigInvalidException {
if (extIdKeys.isEmpty()) {
return;
}

View File

@@ -26,7 +26,6 @@ import com.google.common.base.Suppliers;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Streams;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
import com.google.gerrit.index.Schema;
import com.google.gerrit.reviewdb.client.Account;
@@ -216,15 +215,14 @@ public class AccountResolver {
return false;
}
Optional<I> tryParse(String input) throws IOException, StorageException;
Optional<I> tryParse(String input) throws IOException;
Stream<AccountState> search(I input)
throws StorageException, IOException, ConfigInvalidException;
Stream<AccountState> search(I input) throws IOException, ConfigInvalidException;
boolean shortCircuitIfNoResults();
default Optional<Stream<AccountState>> trySearch(String input)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
Optional<I> parsed = tryParse(input);
return parsed.isPresent() ? Optional.of(search(parsed.get())) : Optional.empty();
}
@@ -336,7 +334,7 @@ public class AccountResolver {
}
@Override
public Stream<AccountState> search(String nameOrEmail) throws StorageException, IOException {
public Stream<AccountState> search(String nameOrEmail) throws IOException {
// TODO(dborowitz): This would probably work as a Searcher<Address>
int lt = nameOrEmail.indexOf('<');
int gt = nameOrEmail.indexOf('>');
@@ -369,7 +367,7 @@ public class AccountResolver {
}
@Override
public Stream<AccountState> search(String input) throws StorageException, IOException {
public Stream<AccountState> search(String input) throws IOException {
return toAccountStates(emails.getAccountFor(input));
}
@@ -398,7 +396,7 @@ public class AccountResolver {
}
@Override
public Optional<AccountState> tryParse(String input) throws StorageException {
public Optional<AccountState> tryParse(String input) {
List<AccountState> results =
accountQueryProvider.get().enforceVisibility(true).byFullName(input);
return results.size() == 1 ? Optional.of(results.get(0)) : Optional.empty();
@@ -427,7 +425,7 @@ public class AccountResolver {
}
@Override
public Stream<AccountState> search(String input) throws StorageException {
public Stream<AccountState> search(String input) {
// At this point we have no clue. Just perform a whole bunch of suggestions and pray we come
// up with a reasonable result list.
// TODO(dborowitz): This doesn't match the documentation; consider whether it's possible to be
@@ -514,11 +512,10 @@ public class AccountResolver {
*
* @param input input string.
* @return a result describing matching accounts. Never null even if the result set is empty.
* @throws StorageException if an error occurs.
* @throws ConfigInvalidException if an error occurs.
* @throws IOException if an error occurs.
*/
public Result resolve(String input) throws StorageException, ConfigInvalidException, IOException {
public Result resolve(String input) throws ConfigInvalidException, IOException {
return searchImpl(input, searchers, visibilitySupplier());
}
@@ -540,15 +537,13 @@ public class AccountResolver {
*
* @param input input string.
* @return a result describing matching accounts. Never null even if the result set is empty.
* @throws StorageException if an error occurs.
* @throws ConfigInvalidException if an error occurs.
* @throws IOException if an error occurs.
* @deprecated for use only by MailUtil for parsing commit footers; that class needs to be
* reevaluated.
*/
@Deprecated
public Result resolveByNameOrEmail(String input)
throws StorageException, ConfigInvalidException, IOException {
public Result resolveByNameOrEmail(String input) throws ConfigInvalidException, IOException {
return searchImpl(input, nameOrEmailSearchers, visibilitySupplier());
}
@@ -561,7 +556,7 @@ public class AccountResolver {
String input,
ImmutableList<Searcher<?>> searchers,
Supplier<Predicate<AccountState>> visibilitySupplier)
throws StorageException, ConfigInvalidException, IOException {
throws ConfigInvalidException, IOException {
visibilitySupplier = Suppliers.memoize(visibilitySupplier::get);
List<AccountState> inactive = new ArrayList<>();

View File

@@ -295,12 +295,11 @@ public class AccountsUpdate {
* @return the newly created account
* @throws DuplicateKeyException if the account already exists
* @throws IOException if creating the user branch fails due to an IO error
* @throws StorageException if creating the user branch fails
* @throws ConfigInvalidException if any of the account fields has an invalid value
*/
public AccountState insert(
String message, Account.Id accountId, Consumer<InternalAccountUpdate.Builder> init)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
return insert(message, accountId, AccountUpdater.fromConsumer(init));
}
@@ -313,11 +312,10 @@ public class AccountsUpdate {
* @return the newly created account
* @throws DuplicateKeyException if the account already exists
* @throws IOException if creating the user branch fails due to an IO error
* @throws StorageException if creating the user branch fails
* @throws ConfigInvalidException if any of the account fields has an invalid value
*/
public AccountState insert(String message, Account.Id accountId, AccountUpdater updater)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
return updateAccount(
r -> {
AccountConfig accountConfig = read(r, accountId);
@@ -351,12 +349,11 @@ public class AccountsUpdate {
* @throws IOException if updating the user branch fails due to an IO error
* @throws LockFailureException if updating the user branch still fails due to concurrent updates
* after the retry timeout exceeded
* @throws StorageException if updating the user branch fails
* @throws ConfigInvalidException if any of the account fields has an invalid value
*/
public Optional<AccountState> update(
String message, Account.Id accountId, Consumer<InternalAccountUpdate.Builder> update)
throws StorageException, LockFailureException, IOException, ConfigInvalidException {
throws LockFailureException, IOException, ConfigInvalidException {
return update(message, accountId, AccountUpdater.fromConsumer(update));
}
@@ -372,11 +369,10 @@ public class AccountsUpdate {
* @throws IOException if updating the user branch fails due to an IO error
* @throws LockFailureException if updating the user branch still fails due to concurrent updates
* after the retry timeout exceeded
* @throws StorageException if updating the user branch fails
* @throws ConfigInvalidException if any of the account fields has an invalid value
*/
public Optional<AccountState> update(String message, Account.Id accountId, AccountUpdater updater)
throws StorageException, LockFailureException, IOException, ConfigInvalidException {
throws LockFailureException, IOException, ConfigInvalidException {
return updateAccount(
r -> {
AccountConfig accountConfig = read(r, accountId);
@@ -407,7 +403,7 @@ public class AccountsUpdate {
}
private Optional<AccountState> updateAccount(AccountUpdate accountUpdate)
throws IOException, ConfigInvalidException, StorageException {
throws IOException, ConfigInvalidException {
return executeAccountUpdate(
() -> {
try (Repository allUsersRepo = repoManager.openRepository(allUsersName)) {
@@ -423,7 +419,7 @@ public class AccountsUpdate {
}
private Optional<AccountState> executeAccountUpdate(Action<Optional<AccountState>> action)
throws IOException, ConfigInvalidException, StorageException {
throws IOException, ConfigInvalidException {
try {
return retryHelper.execute(
ActionType.ACCOUNT_UPDATE, action, LockFailureException.class::isInstance);
@@ -562,8 +558,7 @@ public class AccountsUpdate {
@FunctionalInterface
private static interface AccountUpdate {
UpdatedAccount update(Repository allUsersRepo)
throws IOException, ConfigInvalidException, StorageException;
UpdatedAccount update(Repository allUsersRepo) throws IOException, ConfigInvalidException;
}
private static class UpdatedAccount {

View File

@@ -69,7 +69,7 @@ public class Emails {
*
* @see #getAccountsFor(String...)
*/
public ImmutableSet<Account.Id> getAccountFor(String email) throws IOException, StorageException {
public ImmutableSet<Account.Id> getAccountFor(String email) throws IOException {
return Streams.concat(
externalIds.byEmail(email).stream().map(ExternalId::accountId),
executeIndexQuery(() -> queryProvider.get().byPreferredEmail(email).stream())
@@ -83,7 +83,7 @@ public class Emails {
* @see #getAccountFor(String)
*/
public ImmutableSetMultimap<String, Account.Id> getAccountsFor(String... emails)
throws IOException, StorageException {
throws IOException {
ImmutableSetMultimap.Builder<String, Account.Id> builder = ImmutableSetMultimap.builder();
externalIds.byEmails(emails).entries().stream()
.forEach(e -> builder.put(e.getKey(), e.getValue().accountId()));
@@ -102,7 +102,7 @@ public class Emails {
return externalIds.byEmail(email).stream().map(ExternalId::accountId).collect(toImmutableSet());
}
private <T> T executeIndexQuery(Action<T> action) throws StorageException {
private <T> T executeIndexQuery(Action<T> action) {
try {
return retryHelper.execute(
ActionType.INDEX_QUERY, action, StorageException.class::isInstance);

View File

@@ -22,7 +22,6 @@ import com.google.common.cache.LoadingCache;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.AccountGroup;
import com.google.gerrit.server.cache.CacheModule;
@@ -152,7 +151,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
}
@Override
public ImmutableSet<AccountGroup.UUID> load(Account.Id memberId) throws StorageException {
public ImmutableSet<AccountGroup.UUID> load(Account.Id memberId) {
try (TraceTimer timer = TraceContext.newTimer("Loading groups with member %s", memberId)) {
return groupQueryProvider.get().byMember(memberId).stream()
.map(InternalGroup::getGroupUUID)
@@ -171,7 +170,7 @@ public class GroupIncludeCacheImpl implements GroupIncludeCache {
}
@Override
public ImmutableList<AccountGroup.UUID> load(AccountGroup.UUID key) throws StorageException {
public ImmutableList<AccountGroup.UUID> load(AccountGroup.UUID key) {
try (TraceTimer timer = TraceContext.newTimer("Loading parent groups of %s", key)) {
return groupQueryProvider.get().bySubgroup(key).stream()
.map(InternalGroup::getGroupUUID)

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.account;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.ResourceNotFoundException;
import com.google.gerrit.extensions.restapi.Response;
@@ -48,7 +47,7 @@ public class SetInactiveFlag {
}
public Response<?> deactivate(Account.Id accountId)
throws RestApiException, IOException, ConfigInvalidException, StorageException {
throws RestApiException, IOException, ConfigInvalidException {
AtomicBoolean alreadyInactive = new AtomicBoolean(false);
AtomicReference<Optional<RestApiException>> exception = new AtomicReference<>(Optional.empty());
accountsUpdateProvider
@@ -81,7 +80,7 @@ public class SetInactiveFlag {
}
public Response<String> activate(Account.Id accountId)
throws RestApiException, IOException, ConfigInvalidException, StorageException {
throws RestApiException, IOException, ConfigInvalidException {
AtomicBoolean alreadyActive = new AtomicBoolean(false);
AtomicReference<Optional<RestApiException>> exception = new AtomicReference<>(Optional.empty());
accountsUpdateProvider

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.api.changes;
import static com.google.gerrit.server.api.ApiUtil.asRestApiException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.ChangeEditApi;
import com.google.gerrit.extensions.api.changes.PublishChangeEditInput;
import com.google.gerrit.extensions.client.ChangeEditDetailOption;
@@ -242,7 +241,7 @@ public class ChangeEditApiImpl implements ChangeEditApi {
}
private ChangeEditResource getChangeEditResource(String filePath)
throws ResourceNotFoundException, AuthException, IOException, StorageException {
throws ResourceNotFoundException, AuthException, IOException {
return changeEdits.parse(changeResource, IdString.fromDecoded(filePath));
}
}

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
import com.google.common.base.Strings;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
@@ -79,8 +78,7 @@ public class AbandonOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx)
throws StorageException, ResourceConflictException {
public boolean updateChange(ChangeContext ctx) throws ResourceConflictException {
change = ctx.getChange();
PatchSet.Id psId = change.currentPatchSetId();
ChangeUpdate update = ctx.getUpdate(psId);
@@ -109,7 +107,7 @@ public class AbandonOp implements BatchUpdateOp {
}
@Override
public void postUpdate(Context ctx) throws StorageException {
public void postUpdate(Context ctx) {
NotifyResolver.Result notify = ctx.getNotify(change.getId());
try {
ReplyToChangeSender cm = abandonedSenderFactory.create(ctx.getProject(), change.getId());

View File

@@ -103,7 +103,7 @@ public class AbandonUtil {
}
private Collection<ChangeData> getValidChanges(Collection<ChangeData> changes, String query)
throws StorageException, QueryParseException {
throws QueryParseException {
Collection<ChangeData> validChanges = new ArrayList<>();
for (ChangeData cd : changes) {
String newQuery = query + " change:" + cd.getId();

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.change;
import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableSet;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.PatchSet;
import java.util.Collection;
@@ -54,9 +53,8 @@ public interface AccountPatchReviewStore {
* @param path file path
* @return {@code true} if the reviewed flag was updated, {@code false} if the reviewed flag was
* already set
* @throws StorageException thrown if updating the reviewed flag failed
*/
boolean markReviewed(PatchSet.Id psId, Account.Id accountId, String path) throws StorageException;
boolean markReviewed(PatchSet.Id psId, Account.Id accountId, String path);
/**
* Marks the given files in the given patch set as reviewed by the given user.
@@ -64,10 +62,8 @@ public interface AccountPatchReviewStore {
* @param psId patch set ID
* @param accountId account ID of the user
* @param paths file paths
* @throws StorageException thrown if updating the reviewed flag failed
*/
void markReviewed(PatchSet.Id psId, Account.Id accountId, Collection<String> paths)
throws StorageException;
void markReviewed(PatchSet.Id psId, Account.Id accountId, Collection<String> paths);
/**
* Clears the reviewed flag for the given file in the given patch set for the given user.
@@ -75,17 +71,15 @@ public interface AccountPatchReviewStore {
* @param psId patch set ID
* @param accountId account ID of the user
* @param path file path
* @throws StorageException thrown if clearing the reviewed flag failed
*/
void clearReviewed(PatchSet.Id psId, Account.Id accountId, String path) throws StorageException;
void clearReviewed(PatchSet.Id psId, Account.Id accountId, String path);
/**
* Clears the reviewed flags for all files in the given patch set for all users.
*
* @param psId patch set ID
* @throws StorageException thrown if clearing the reviewed flags failed
*/
void clearReviewed(PatchSet.Id psId) throws StorageException;
void clearReviewed(PatchSet.Id psId);
/**
* Find the latest patch set, that is smaller or equals to the given patch set, where at least,
@@ -95,8 +89,6 @@ public interface AccountPatchReviewStore {
* @param accountId account ID of the user
* @return optionally, all files the have been reviewed by the given user that belong to the patch
* set that is smaller or equals to the given patch set
* @throws StorageException thrown if accessing the reviewed flags failed
*/
Optional<PatchSetWithReviewedFiles> findReviewed(PatchSet.Id psId, Account.Id accountId)
throws StorageException;
Optional<PatchSetWithReviewedFiles> findReviewed(PatchSet.Id psId, Account.Id accountId);
}

View File

@@ -20,7 +20,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.ActionVisitor;
import com.google.gerrit.extensions.common.ActionInfo;
import com.google.gerrit.extensions.common.ChangeInfo;
@@ -70,7 +69,7 @@ public class ActionJson {
this.userProvider = userProvider;
}
public Map<String, ActionInfo> format(RevisionResource rsrc) throws StorageException {
public Map<String, ActionInfo> format(RevisionResource rsrc) {
ChangeInfo changeInfo = null;
RevisionInfo revisionInfo = null;
List<ActionVisitor> visitors = visitors();
@@ -97,8 +96,7 @@ public class ActionJson {
}
public RevisionInfo addRevisionActions(
@Nullable ChangeInfo changeInfo, RevisionInfo to, RevisionResource rsrc)
throws StorageException {
@Nullable ChangeInfo changeInfo, RevisionInfo to, RevisionResource rsrc) {
List<ActionVisitor> visitors = visitors();
if (!visitors.isEmpty()) {
if (changeInfo != null) {

View File

@@ -27,7 +27,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.common.collect.Streams;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.client.ReviewerState;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.mail.Address;
@@ -157,8 +156,7 @@ public class AddReviewersOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx)
throws RestApiException, StorageException, IOException {
public boolean updateChange(ChangeContext ctx) throws RestApiException, IOException {
change = ctx.getChange();
if (!accountIds.isEmpty()) {
if (state == CC) {

View File

@@ -106,7 +106,7 @@ public class ChangeFinder {
this.allowedIdTypes = ImmutableSet.copyOf(configuredChangeIdTypes);
}
public ChangeNotes findOne(String id) throws StorageException {
public ChangeNotes findOne(String id) {
List<ChangeNotes> ctls = find(id);
if (ctls.size() != 1) {
return null;
@@ -119,9 +119,8 @@ public class ChangeFinder {
*
* @param id change identifier.
* @return possibly-empty list of notes for all matching changes; may or may not be visible.
* @throws StorageException if an error occurred querying the database.
*/
public List<ChangeNotes> find(String id) throws StorageException {
public List<ChangeNotes> find(String id) {
try {
return find(id, false);
} catch (DeprecatedIdentifierException e) {
@@ -137,11 +136,10 @@ public class ChangeFinder {
* @param enforceDeprecation boolean to see if we should throw {@link
* DeprecatedIdentifierException} in case the identifier is deprecated
* @return possibly-empty list of notes for all matching changes; may or may not be visible.
* @throws StorageException if an error occurred querying the database
* @throws DeprecatedIdentifierException if the identifier is deprecated.
*/
public List<ChangeNotes> find(String id, boolean enforceDeprecation)
throws StorageException, DeprecatedIdentifierException {
throws DeprecatedIdentifierException {
if (id.isEmpty()) {
return Collections.emptyList();
}
@@ -194,8 +192,7 @@ public class ChangeFinder {
return notes;
}
private List<ChangeNotes> fromProjectNumber(String project, int changeNumber)
throws StorageException {
private List<ChangeNotes> fromProjectNumber(String project, int changeNumber) {
Change.Id cId = new Change.Id(changeNumber);
try {
return ImmutableList.of(
@@ -212,7 +209,7 @@ public class ChangeFinder {
}
}
public ChangeNotes findOne(Change.Id id) throws StorageException {
public ChangeNotes findOne(Change.Id id) {
List<ChangeNotes> notes = find(id);
if (notes.size() != 1) {
throw new NoSuchChangeException(id);
@@ -220,7 +217,7 @@ public class ChangeFinder {
return notes.get(0);
}
public List<ChangeNotes> find(Change.Id id) throws StorageException {
public List<ChangeNotes> find(Change.Id id) {
String project = changeIdProjectCache.getIfPresent(id);
if (project != null) {
return fromProjectNumber(project, id.get());
@@ -236,7 +233,7 @@ public class ChangeFinder {
return asChangeNotes(r);
}
private List<ChangeNotes> asChangeNotes(List<ChangeData> cds) throws StorageException {
private List<ChangeNotes> asChangeNotes(List<ChangeData> cds) {
List<ChangeNotes> notes = new ArrayList<>(cds.size());
if (!indexConfig.separateChangeSubIndexes()) {
for (ChangeData cd : cds) {

View File

@@ -30,7 +30,6 @@ import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.client.ReviewerState;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
@@ -369,8 +368,7 @@ public class ChangeInserter implements InsertChangeOp {
@Override
public boolean updateChange(ChangeContext ctx)
throws RestApiException, StorageException, IOException, PermissionBackendException,
ConfigInvalidException {
throws RestApiException, IOException, PermissionBackendException, ConfigInvalidException {
change = ctx.getChange(); // Use defensive copy created by ChangeControl.
patchSetInfo =
patchSetInfoFactory.get(ctx.getRevWalk(), ctx.getRevWalk().parseCommit(commitId), psId);

View File

@@ -268,23 +268,23 @@ public class ChangeJson {
return this;
}
public ChangeInfo format(ChangeResource rsrc) throws StorageException {
public ChangeInfo format(ChangeResource rsrc) {
return format(changeDataFactory.create(rsrc.getNotes()));
}
public ChangeInfo format(Change change) throws StorageException {
public ChangeInfo format(Change change) {
return format(changeDataFactory.create(change));
}
public ChangeInfo format(Project.NameKey project, Change.Id id) throws StorageException {
public ChangeInfo format(Project.NameKey project, Change.Id id) {
return format(project, id, ChangeInfo::new);
}
public ChangeInfo format(ChangeData cd) throws StorageException {
public ChangeInfo format(ChangeData cd) {
return format(cd, Optional.empty(), true, ChangeInfo::new);
}
public ChangeInfo format(RevisionResource rsrc) throws StorageException {
public ChangeInfo format(RevisionResource rsrc) {
ChangeData cd = changeDataFactory.create(rsrc.getNotes());
return format(cd, Optional.of(rsrc.getPatchSet().getId()), true, ChangeInfo::new);
}
@@ -308,8 +308,7 @@ public class ChangeJson {
}
}
public List<ChangeInfo> format(Collection<ChangeData> in)
throws StorageException, PermissionBackendException {
public List<ChangeInfo> format(Collection<ChangeData> in) throws PermissionBackendException {
accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS));
ensureLoaded(in);
List<ChangeInfo> out = new ArrayList<>(in.size());
@@ -321,8 +320,7 @@ public class ChangeJson {
}
public <I extends ChangeInfo> I format(
Project.NameKey project, Change.Id id, Supplier<I> changeInfoSupplier)
throws StorageException {
Project.NameKey project, Change.Id id, Supplier<I> changeInfoSupplier) {
ChangeNotes notes;
try {
notes = notesFactory.createChecked(project, id);
@@ -367,8 +365,7 @@ public class ChangeJson {
ChangeData cd,
Optional<PatchSet.Id> limitToPsId,
boolean fillAccountLoader,
Supplier<I> changeInfoSupplier)
throws StorageException {
Supplier<I> changeInfoSupplier) {
try {
if (fillAccountLoader) {
accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS));
@@ -390,7 +387,7 @@ public class ChangeJson {
}
}
private void ensureLoaded(Iterable<ChangeData> all) throws StorageException {
private void ensureLoaded(Iterable<ChangeData> all) {
if (lazyLoad) {
ChangeData.ensureChangeLoaded(all);
if (has(ALL_REVISIONS)) {
@@ -477,8 +474,7 @@ public class ChangeJson {
private <I extends ChangeInfo> I toChangeInfo(
ChangeData cd, Optional<PatchSet.Id> limitToPsId, Supplier<I> changeInfoSupplier)
throws PatchListNotAvailableException, GpgException, StorageException,
PermissionBackendException, IOException {
throws PatchListNotAvailableException, GpgException, PermissionBackendException, IOException {
try (Timer0.Context ignored = metrics.toChangeInfoLatency.start()) {
return toChangeInfoImpl(cd, limitToPsId, changeInfoSupplier);
}
@@ -486,8 +482,7 @@ public class ChangeJson {
private <I extends ChangeInfo> I toChangeInfoImpl(
ChangeData cd, Optional<PatchSet.Id> limitToPsId, Supplier<I> changeInfoSupplier)
throws PatchListNotAvailableException, GpgException, StorageException,
PermissionBackendException, IOException {
throws PatchListNotAvailableException, GpgException, PermissionBackendException, IOException {
I out = changeInfoSupplier.get();
CurrentUser user = userProvider.get();
@@ -638,7 +633,7 @@ public class ChangeJson {
return reviewerMap;
}
private Collection<ReviewerUpdateInfo> reviewerUpdates(ChangeData cd) throws StorageException {
private Collection<ReviewerUpdateInfo> reviewerUpdates(ChangeData cd) {
List<ReviewerStatusUpdate> reviewerUpdates = cd.reviewerUpdates();
List<ReviewerUpdateInfo> result = new ArrayList<>(reviewerUpdates.size());
for (ReviewerStatusUpdate c : reviewerUpdates) {
@@ -656,7 +651,7 @@ public class ChangeJson {
return SubmitRecord.allRecordsOK(cd.submitRecords(SUBMIT_RULE_OPTIONS_STRICT));
}
private void setSubmitter(ChangeData cd, ChangeInfo out) throws StorageException {
private void setSubmitter(ChangeData cd, ChangeInfo out) {
Optional<PatchSetApproval> s = cd.getSubmitApproval();
if (!s.isPresent()) {
return;
@@ -665,7 +660,7 @@ public class ChangeJson {
out.submitter = accountLoader.get(s.get().getAccountId());
}
private Collection<ChangeMessageInfo> messages(ChangeData cd) throws StorageException {
private Collection<ChangeMessageInfo> messages(ChangeData cd) {
List<ChangeMessage> messages = cmUtil.byChange(cd.notes());
if (messages.isEmpty()) {
return Collections.emptyList();
@@ -679,7 +674,7 @@ public class ChangeJson {
}
private Collection<AccountInfo> removableReviewers(ChangeData cd, ChangeInfo out)
throws PermissionBackendException, StorageException {
throws PermissionBackendException {
// Although this is called removableReviewers, this method also determines
// which CCs are removable.
//
@@ -767,8 +762,8 @@ public class ChangeJson {
.collect(toList());
}
private Map<PatchSet.Id, PatchSet> loadPatchSets(ChangeData cd, Optional<PatchSet.Id> limitToPsId)
throws StorageException {
private Map<PatchSet.Id, PatchSet> loadPatchSets(
ChangeData cd, Optional<PatchSet.Id> limitToPsId) {
Collection<PatchSet> src;
if (has(ALL_REVISIONS) || has(MESSAGES)) {
src = cd.patchSets();
@@ -799,8 +794,7 @@ public class ChangeJson {
* from either an index-backed or a database-backed {@link ChangeData} depending on {@code
* lazyload}.
*/
private PermissionBackend.ForChange permissionBackendForChange(CurrentUser user, ChangeData cd)
throws StorageException {
private PermissionBackend.ForChange permissionBackendForChange(CurrentUser user, ChangeData cd) {
PermissionBackend.WithUser withUser = permissionBackend.user(user);
return lazyLoad
? withUser.change(cd)

View File

@@ -574,7 +574,7 @@ public class ConsistencyChecker {
}
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException {
public boolean updateChange(ChangeContext ctx) {
ctx.getChange().setStatus(Change.Status.MERGED);
ctx.getUpdate(ctx.getChange().currentPatchSetId()).fixStatus(Change.Status.MERGED);
p.status = Status.FIXED;
@@ -672,8 +672,7 @@ public class ConsistencyChecker {
}
@Override
public boolean updateChange(ChangeContext ctx)
throws StorageException, PatchSetInfoNotAvailableException {
public boolean updateChange(ChangeContext ctx) throws PatchSetInfoNotAvailableException {
// Delete dangling key references.
accountPatchReviewStore.run(s -> s.clearReviewed(psId), StorageException.class);
@@ -706,8 +705,7 @@ public class ConsistencyChecker {
@Override
public boolean updateChange(ChangeContext ctx)
throws StorageException, PatchSetInfoNotAvailableException,
NoPatchSetsWouldRemainException {
throws PatchSetInfoNotAvailableException, NoPatchSetsWouldRemainException {
if (!toDelete.contains(ctx.getChange().currentPatchSetId())) {
return false;
}

View File

@@ -66,8 +66,7 @@ public class DeleteChangeOp implements BatchUpdateOp {
// executed in a single atomic BatchRefUpdate. Actually deleting the change refs first would not
// fail gracefully if the second delete fails, but fortunately that's not what happens.
@Override
public boolean updateChange(ChangeContext ctx)
throws RestApiException, StorageException, IOException {
public boolean updateChange(ChangeContext ctx) throws RestApiException, IOException {
Collection<PatchSet> patchSets = psUtil.byChange(ctx.getNotes());
ensureDeletable(ctx, id, patchSets);
@@ -107,7 +106,7 @@ public class DeleteChangeOp implements BatchUpdateOp {
}
private void cleanUpReferences(ChangeContext ctx, Change.Id id, Collection<PatchSet> patchSets)
throws StorageException, NoSuchChangeException {
throws NoSuchChangeException {
for (PatchSet ps : patchSets) {
accountPatchReviewStore.run(s -> s.clearReviewed(ps.getId()), StorageException.class);
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.change;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.mail.Address;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
@@ -50,7 +49,7 @@ public class DeleteReviewerByEmailOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException {
public boolean updateChange(ChangeContext ctx) {
change = ctx.getChange();
PatchSet.Id psId = ctx.getChange().currentPatchSetId();
String msg = "Removed reviewer " + reviewer;

View File

@@ -19,7 +19,6 @@ import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.DeleteReviewerInput;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.restapi.AuthException;
@@ -108,8 +107,7 @@ public class DeleteReviewerOp implements BatchUpdateOp {
@Override
public boolean updateChange(ChangeContext ctx)
throws AuthException, ResourceNotFoundException, StorageException, PermissionBackendException,
IOException {
throws AuthException, ResourceNotFoundException, PermissionBackendException, IOException {
Account.Id reviewerId = reviewer.getAccount().getId();
// Check of removing this reviewer (even if there is no vote processed by the loop below) is OK
removeReviewerControl.checkRemoveReviewer(ctx.getNotes(), ctx.getUser(), reviewerId);
@@ -194,8 +192,7 @@ public class DeleteReviewerOp implements BatchUpdateOp {
ctx.getWhen());
}
private Iterable<PatchSetApproval> approvals(ChangeContext ctx, Account.Id accountId)
throws StorageException {
private Iterable<PatchSetApproval> approvals(ChangeContext ctx, Account.Id accountId) {
Iterable<PatchSetApproval> approvals;
approvals = approvalsUtil.byChange(ctx.getNotes()).values();
return Iterables.filter(approvals, psa -> accountId.equals(psa.getAccountId()));

View File

@@ -36,7 +36,6 @@ import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.LabelValue;
import com.google.gerrit.common.data.SubmitRecord;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.ApprovalInfo;
import com.google.gerrit.extensions.common.LabelInfo;
@@ -100,7 +99,7 @@ public class LabelsJson {
*/
Map<String, LabelInfo> labelsFor(
AccountLoader accountLoader, ChangeData cd, boolean standard, boolean detailed)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
if (!standard && !detailed) {
return null;
}
@@ -115,7 +114,7 @@ public class LabelsJson {
/** Returns all labels that the provided user has permission to vote on. */
Map<String, Collection<String>> permittedLabels(Account.Id filterApprovalsBy, ChangeData cd)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
boolean isMerged = cd.change().isMerged();
LabelTypes labelTypes = cd.getLabelTypes();
Map<String, LabelType> toCheck = new HashMap<>();
@@ -194,7 +193,7 @@ public class LabelsJson {
LabelTypes labelTypes,
boolean standard,
boolean detailed)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
Map<String, LabelWithStatus> labels = initLabels(accountLoader, cd, labelTypes, standard);
if (detailed) {
setAllApprovals(accountLoader, cd, labels);
@@ -252,8 +251,7 @@ public class LabelsJson {
}
}
private Map<String, Short> currentLabels(Account.Id accountId, ChangeData cd)
throws StorageException {
private Map<String, Short> currentLabels(Account.Id accountId, ChangeData cd) {
Map<String, Short> result = new HashMap<>();
for (PatchSetApproval psa :
approvalsUtil.byPatchSetUser(
@@ -273,7 +271,7 @@ public class LabelsJson {
LabelTypes labelTypes,
boolean standard,
boolean detailed)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
Set<Account.Id> allUsers = new HashSet<>();
if (detailed) {
// Users expect to see all reviewers on closed changes, even if they
@@ -431,7 +429,7 @@ public class LabelsJson {
private void setAllApprovals(
AccountLoader accountLoader, ChangeData cd, Map<String, LabelWithStatus> labels)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
checkState(
!cd.change().isMerged(),
"should not call setAllApprovals on %s change",
@@ -499,8 +497,7 @@ public class LabelsJson {
* from either an index-backed or a database-backed {@link ChangeData} depending on {@code
* lazyload}.
*/
private PermissionBackend.ForChange permissionBackendForChange(Account.Id user, ChangeData cd)
throws StorageException {
private PermissionBackend.ForChange permissionBackendForChange(Account.Id user, ChangeData cd) {
PermissionBackend.WithUser withUser = permissionBackend.absentUser(user);
return lazyLoad
? withUser.change(cd)

View File

@@ -21,7 +21,6 @@ import com.google.auto.value.AutoValue;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSetMultimap;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.NotifyInfo;
import com.google.gerrit.extensions.api.changes.RecipientType;
@@ -81,7 +80,7 @@ public class NotifyResolver {
public Result resolve(
NotifyHandling handling, @Nullable Map<RecipientType, NotifyInfo> notifyDetails)
throws BadRequestException, StorageException, IOException, ConfigInvalidException {
throws BadRequestException, IOException, ConfigInvalidException {
requireNonNull(handling);
ImmutableSetMultimap.Builder<RecipientType, Account.Id> b = ImmutableSetMultimap.builder();
if (notifyDetails != null) {
@@ -93,7 +92,7 @@ public class NotifyResolver {
}
private ImmutableList<Account.Id> find(@Nullable List<String> inputs)
throws StorageException, BadRequestException, IOException, ConfigInvalidException {
throws BadRequestException, IOException, ConfigInvalidException {
if (inputs == null || inputs.isEmpty()) {
return ImmutableList.of();
}

View File

@@ -20,7 +20,6 @@ import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
import static java.util.Objects.requireNonNull;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
@@ -187,15 +186,13 @@ public class PatchSetInserter implements BatchUpdateOp {
@Override
public void updateRepo(RepoContext ctx)
throws AuthException, ResourceConflictException, IOException, StorageException,
PermissionBackendException {
throws AuthException, ResourceConflictException, IOException, PermissionBackendException {
validate(ctx);
ctx.addRefUpdate(ObjectId.zeroId(), commitId, getPatchSetId().toRefName());
}
@Override
public boolean updateChange(ChangeContext ctx)
throws ResourceConflictException, StorageException, IOException {
public boolean updateChange(ChangeContext ctx) throws ResourceConflictException, IOException {
change = ctx.getChange();
ChangeUpdate update = ctx.getUpdate(psId);
update.setSubjectForCommit("Create patch set " + psId.get());
@@ -271,8 +268,7 @@ public class PatchSetInserter implements BatchUpdateOp {
}
private void validate(RepoContext ctx)
throws AuthException, ResourceConflictException, IOException, PermissionBackendException,
StorageException {
throws AuthException, ResourceConflictException, IOException, PermissionBackendException {
// Not allowed to create a new patch set if the current patch set is locked.
psUtil.checkPatchSetNotLocked(origNotes);

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.change;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.reviewdb.client.PatchSet;
@@ -38,7 +37,7 @@ public class PureRevert {
}
public boolean get(ChangeNotes notes, Optional<String> claimedOriginal)
throws StorageException, IOException, BadRequestException, ResourceConflictException {
throws IOException, BadRequestException, ResourceConflictException {
PatchSet currentPatchSet = notes.getCurrentPatchSet();
if (currentPatchSet == null) {
throw new ResourceConflictException("current revision is missing");

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.change;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.MergeConflictException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.RestApiException;
@@ -149,7 +148,7 @@ public class RebaseChangeOp implements BatchUpdateOp {
@Override
public void updateRepo(RepoContext ctx)
throws MergeConflictException, InvalidChangeOperationException, RestApiException, IOException,
StorageException, NoSuchChangeException, PermissionBackendException {
NoSuchChangeException, PermissionBackendException {
// Ok that originalPatchSet was not read in a transaction, since we just
// need its revision.
RevId oldRev = originalPatchSet.getRevision();
@@ -213,15 +212,14 @@ public class RebaseChangeOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx)
throws ResourceConflictException, StorageException, IOException {
public boolean updateChange(ChangeContext ctx) throws ResourceConflictException, IOException {
boolean ret = patchSetInserter.updateChange(ctx);
rebasedPatchSet = patchSetInserter.getPatchSet();
return ret;
}
@Override
public void postUpdate(Context ctx) throws StorageException {
public void postUpdate(Context ctx) {
patchSetInserter.postUpdate(ctx);
}

View File

@@ -83,7 +83,7 @@ public class RebaseUtil {
public abstract PatchSet patchSet();
}
public Base parseBase(RevisionResource rsrc, String base) throws StorageException {
public Base parseBase(RevisionResource rsrc, String base) {
// Try parsing the base as a ref string.
PatchSet.Id basePatchSetId = PatchSet.Id.fromRef(base);
if (basePatchSetId != null) {
@@ -119,7 +119,7 @@ public class RebaseUtil {
return ret;
}
private ChangeNotes notesFor(RevisionResource rsrc, Change.Id id) throws StorageException {
private ChangeNotes notesFor(RevisionResource rsrc, Change.Id id) {
if (rsrc.getChange().getId().equals(id)) {
return rsrc.getNotes();
}
@@ -139,11 +139,10 @@ public class RebaseUtil {
* @return the commit onto which the patch set should be rebased.
* @throws RestApiException if rebase is not possible.
* @throws IOException if accessing the repository fails.
* @throws StorageException if accessing the database fails.
*/
public ObjectId findBaseRevision(
PatchSet patchSet, Branch.NameKey destBranch, Repository git, RevWalk rw)
throws RestApiException, IOException, StorageException {
throws RestApiException, IOException {
String baseRev = null;
RevCommit commit = rw.parseCommit(ObjectId.fromString(patchSet.getRevision().get()));

View File

@@ -31,7 +31,6 @@ import com.google.common.collect.Streams;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.AddReviewerInput;
import com.google.gerrit.extensions.api.changes.AddReviewerResult;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
@@ -188,14 +187,13 @@ public class ReviewerAdder {
* @return handle describing the addition operation. If the {@code op} field is present, this
* operation may be added to a {@code BatchUpdate}. Otherwise, the {@code error} field
* contains information about an error that occurred
* @throws StorageException
* @throws IOException
* @throws PermissionBackendException
* @throws ConfigInvalidException
*/
public ReviewerAddition prepare(
ChangeNotes notes, CurrentUser user, AddReviewerInput input, boolean allowGroup)
throws StorageException, IOException, PermissionBackendException, ConfigInvalidException {
throws IOException, PermissionBackendException, ConfigInvalidException {
requireNonNull(input.reviewer);
boolean confirmed = input.confirmed();
boolean allowByEmail =
@@ -245,7 +243,7 @@ public class ReviewerAdder {
@Nullable
private ReviewerAddition addByAccountId(
AddReviewerInput input, ChangeNotes notes, CurrentUser user)
throws StorageException, PermissionBackendException, IOException, ConfigInvalidException {
throws PermissionBackendException, IOException, ConfigInvalidException {
IdentifiedUser reviewerUser;
boolean exactMatchFound = false;
try {
@@ -449,7 +447,7 @@ public class ReviewerAdder {
: ImmutableSet.of();
}
public void gatherResults(ChangeData cd) throws StorageException, PermissionBackendException {
public void gatherResults(ChangeData cd) throws PermissionBackendException {
checkState(op != null, "addition did not result in an update op");
checkState(op.getResult() != null, "op did not return a result");
@@ -510,7 +508,7 @@ public class ReviewerAdder {
CurrentUser user,
Iterable<? extends AddReviewerInput> inputs,
boolean allowGroup)
throws StorageException, IOException, PermissionBackendException, ConfigInvalidException {
throws IOException, PermissionBackendException, ConfigInvalidException {
// Process CC ops before reviewer ops, so a user that appears in both lists ends up as a
// reviewer; the last call to ChangeUpdate#putReviewer wins. This can happen if the caller
// specifies the same string twice, or less obviously if they specify multiple groups with
@@ -558,7 +556,7 @@ public class ReviewerAdder {
// We never call updateRepo on the addition ops, which is only ok because it's a no-op.
public void updateChange(ChangeContext ctx, PatchSet patchSet)
throws StorageException, RestApiException, IOException {
throws RestApiException, IOException {
for (ReviewerAddition addition : additions()) {
addition.op.setPatchSet(patchSet);
addition.op.updateChange(ctx);

View File

@@ -21,7 +21,6 @@ import com.google.common.collect.Lists;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.SubmitRecord;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.ReviewerInfo;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.mail.Address;
@@ -65,7 +64,7 @@ public class ReviewerJson {
}
public List<ReviewerInfo> format(Collection<ReviewerResource> rsrcs)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
List<ReviewerInfo> infos = Lists.newArrayListWithCapacity(rsrcs.size());
AccountLoader loader = accountLoaderFactory.create(true);
ChangeData cd = null;
@@ -88,13 +87,12 @@ public class ReviewerJson {
return infos;
}
public List<ReviewerInfo> format(ReviewerResource rsrc)
throws StorageException, PermissionBackendException {
public List<ReviewerInfo> format(ReviewerResource rsrc) throws PermissionBackendException {
return format(ImmutableList.of(rsrc));
}
public ReviewerInfo format(ReviewerInfo out, Account.Id reviewerAccountId, ChangeData cd)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
PatchSet.Id psId = cd.change().currentPatchSetId();
return format(
out,
@@ -108,7 +106,7 @@ public class ReviewerJson {
Account.Id reviewerAccountId,
ChangeData cd,
Iterable<PatchSetApproval> approvals)
throws StorageException, PermissionBackendException {
throws PermissionBackendException {
LabelTypes labelTypes = cd.getLabelTypes();
out.approvals = new TreeMap<>(labelTypes.nameComparator());

View File

@@ -32,7 +32,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.ChangeInfo;
import com.google.gerrit.extensions.common.CommitInfo;
@@ -155,8 +154,7 @@ public class RevisionJson {
* depending on the options provided when constructing this instance.
*/
public RevisionInfo getRevisionInfo(ChangeData cd, PatchSet in)
throws PatchListNotAvailableException, GpgException, StorageException, IOException,
PermissionBackendException {
throws PatchListNotAvailableException, GpgException, IOException, PermissionBackendException {
AccountLoader accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS));
try (Repository repo = openRepoIfNecessary(cd.project());
RevWalk rw = newRevWalk(repo)) {
@@ -213,8 +211,7 @@ public class RevisionJson {
Map<PatchSet.Id, PatchSet> map,
Optional<PatchSet.Id> limitToPsId,
ChangeInfo changeInfo)
throws PatchListNotAvailableException, GpgException, StorageException, IOException,
PermissionBackendException {
throws PatchListNotAvailableException, GpgException, IOException, PermissionBackendException {
Map<String, RevisionInfo> res = new LinkedHashMap<>();
try (Repository repo = openRepoIfNecessary(cd.project());
RevWalk rw = newRevWalk(repo)) {
@@ -239,7 +236,7 @@ public class RevisionJson {
}
private Map<String, FetchInfo> makeFetchMap(ChangeData cd, PatchSet in)
throws PermissionBackendException, StorageException, IOException {
throws PermissionBackendException, IOException {
Map<String, FetchInfo> r = new LinkedHashMap<>();
for (Extension<DownloadScheme> e : downloadSchemes) {
String schemeName = e.getExportName();
@@ -275,8 +272,7 @@ public class RevisionJson {
@Nullable RevWalk rw,
boolean fillCommit,
@Nullable ChangeInfo changeInfo)
throws PatchListNotAvailableException, GpgException, StorageException, IOException,
PermissionBackendException {
throws PatchListNotAvailableException, GpgException, IOException, PermissionBackendException {
Change c = cd.change();
RevisionInfo out = new RevisionInfo();
out.isCurrent = in.getId().equals(c.currentPatchSetId());
@@ -350,14 +346,13 @@ public class RevisionJson {
* lazyload}.
*/
private PermissionBackend.ForChange permissionBackendForChange(
PermissionBackend.WithUser withUser, ChangeData cd) throws StorageException {
PermissionBackend.WithUser withUser, ChangeData cd) {
return lazyLoad
? withUser.change(cd)
: withUser.indexedChange(cd, notesFactory.createFromIndexedChange(cd.change()));
}
private boolean isWorldReadable(ChangeData cd)
throws StorageException, PermissionBackendException, IOException {
private boolean isWorldReadable(ChangeData cd) throws PermissionBackendException, IOException {
try {
permissionBackendForChange(permissionBackend.user(anonymous), cd)
.check(ChangePermission.READ);

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
import static java.util.Objects.requireNonNull;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.extensions.restapi.RestApiException;
import com.google.gerrit.reviewdb.client.Change;
@@ -74,7 +73,7 @@ public class SetAssigneeOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException, RestApiException {
public boolean updateChange(ChangeContext ctx) throws RestApiException {
change = ctx.getChange();
if (newAssignee.getAccountId().equals(change.getAssignee())) {
return false;
@@ -117,7 +116,7 @@ public class SetAssigneeOp implements BatchUpdateOp {
}
@Override
public void postUpdate(Context ctx) throws StorageException {
public void postUpdate(Context ctx) {
try {
SetAssigneeSender cm =
setAssigneeSenderFactory.create(

View File

@@ -21,7 +21,6 @@ import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Ordering;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.HashtagsInput;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.BadRequestException;
@@ -82,8 +81,7 @@ public class SetHashtagsOp implements BatchUpdateOp {
@Override
public boolean updateChange(ChangeContext ctx)
throws AuthException, BadRequestException, MethodNotAllowedException, StorageException,
IOException {
throws AuthException, BadRequestException, MethodNotAllowedException, IOException {
if (input == null || (input.add == null && input.remove == null)) {
updatedHashtags = ImmutableSortedSet.of();
return false;
@@ -146,7 +144,7 @@ public class SetHashtagsOp implements BatchUpdateOp {
}
@Override
public void postUpdate(Context ctx) throws StorageException {
public void postUpdate(Context ctx) {
if (updated() && fireEvent) {
hashtagsEdited.fire(
change, ctx.getAccount(), updatedHashtags, toAdd, toRemove, ctx.getWhen());

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.change;
import com.google.common.base.Strings;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.ResourceConflictException;
import com.google.gerrit.reviewdb.client.Change;
@@ -75,7 +74,7 @@ public class SetPrivateOp implements BatchUpdateOp {
@Override
public boolean updateChange(ChangeContext ctx)
throws ResourceConflictException, StorageException, BadRequestException {
throws ResourceConflictException, BadRequestException {
change = ctx.getChange();
if (ctx.getChange().isPrivate() == isPrivate) {
// No-op

View File

@@ -98,7 +98,7 @@ public class WalkSorter {
return this;
}
public Iterable<PatchSetData> sort(Iterable<ChangeData> in) throws StorageException, IOException {
public Iterable<PatchSetData> sort(Iterable<ChangeData> in) throws IOException {
ListMultimap<Project.NameKey, ChangeData> byProject =
MultimapBuilder.hashKeys().arrayListValues().build();
for (ChangeData cd : in) {
@@ -114,7 +114,7 @@ public class WalkSorter {
}
private List<PatchSetData> sortProject(Project.NameKey project, Collection<ChangeData> in)
throws StorageException, IOException {
throws IOException {
try (Repository repo = repoManager.openRepository(project);
RevWalk rw = new RevWalk(repo)) {
rw.setRetainBody(retainBody);
@@ -217,7 +217,7 @@ public class WalkSorter {
}
private ListMultimap<RevCommit, PatchSetData> byCommit(RevWalk rw, Collection<ChangeData> in)
throws StorageException, IOException {
throws IOException {
ListMultimap<RevCommit, PatchSetData> byCommit =
MultimapBuilder.hashKeys(in.size()).arrayListValues(1).build();
for (ChangeData cd : in) {

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.server.change;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
@@ -85,7 +84,7 @@ public class WorkInProgressOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException {
public boolean updateChange(ChangeContext ctx) {
change = ctx.getChange();
notes = ctx.getNotes();
ps = psUtil.get(ctx.getNotes(), change.currentPatchSetId());

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.edit;
import com.google.common.collect.ImmutableList;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.extensions.restapi.MergeConflictException;
@@ -114,7 +113,7 @@ public class ChangeEditModifier {
* @throws PermissionBackendException
*/
public void createEdit(Repository repository, ChangeNotes notes)
throws AuthException, IOException, InvalidChangeOperationException, StorageException,
throws AuthException, IOException, InvalidChangeOperationException,
PermissionBackendException, ResourceConflictException {
assertCanEdit(notes);
@@ -142,8 +141,8 @@ public class ChangeEditModifier {
* @throws PermissionBackendException
*/
public void rebaseEdit(Repository repository, ChangeNotes notes)
throws AuthException, InvalidChangeOperationException, IOException, StorageException,
MergeConflictException, PermissionBackendException, ResourceConflictException {
throws AuthException, InvalidChangeOperationException, IOException, MergeConflictException,
PermissionBackendException, ResourceConflictException {
assertCanEdit(notes);
Optional<ChangeEdit> optionalChangeEdit = lookupChangeEdit(notes);
@@ -207,7 +206,7 @@ public class ChangeEditModifier {
* @throws BadRequestException if the commit message is malformed
*/
public void modifyMessage(Repository repository, ChangeNotes notes, String newCommitMessage)
throws AuthException, IOException, UnchangedCommitMessageException, StorageException,
throws AuthException, IOException, UnchangedCommitMessageException,
PermissionBackendException, BadRequestException, ResourceConflictException {
assertCanEdit(notes);
newCommitMessage = CommitMessageUtil.checkAndSanitizeCommitMessage(newCommitMessage);
@@ -250,7 +249,7 @@ public class ChangeEditModifier {
*/
public void modifyFile(
Repository repository, ChangeNotes notes, String filePath, RawInput newContent)
throws AuthException, InvalidChangeOperationException, IOException, StorageException,
throws AuthException, InvalidChangeOperationException, IOException,
PermissionBackendException, ResourceConflictException {
modifyTree(repository, notes, new ChangeFileContentModification(filePath, newContent));
}
@@ -268,7 +267,7 @@ public class ChangeEditModifier {
* @throws ResourceConflictException if the project state does not permit the operation
*/
public void deleteFile(Repository repository, ChangeNotes notes, String file)
throws AuthException, InvalidChangeOperationException, IOException, StorageException,
throws AuthException, InvalidChangeOperationException, IOException,
PermissionBackendException, ResourceConflictException {
modifyTree(repository, notes, new DeleteFileModification(file));
}
@@ -289,7 +288,7 @@ public class ChangeEditModifier {
*/
public void renameFile(
Repository repository, ChangeNotes notes, String currentFilePath, String newFilePath)
throws AuthException, InvalidChangeOperationException, IOException, StorageException,
throws AuthException, InvalidChangeOperationException, IOException,
PermissionBackendException, ResourceConflictException {
modifyTree(repository, notes, new RenameFileModification(currentFilePath, newFilePath));
}
@@ -307,14 +306,14 @@ public class ChangeEditModifier {
* @throws PermissionBackendException
*/
public void restoreFile(Repository repository, ChangeNotes notes, String file)
throws AuthException, InvalidChangeOperationException, IOException, StorageException,
throws AuthException, InvalidChangeOperationException, IOException,
PermissionBackendException, ResourceConflictException {
modifyTree(repository, notes, new RestoreFileModification(file));
}
private void modifyTree(
Repository repository, ChangeNotes notes, TreeModification treeModification)
throws AuthException, IOException, StorageException, InvalidChangeOperationException,
throws AuthException, IOException, InvalidChangeOperationException,
PermissionBackendException, ResourceConflictException {
assertCanEdit(notes);
@@ -360,7 +359,7 @@ public class ChangeEditModifier {
PatchSet patchSet,
List<TreeModification> treeModifications)
throws AuthException, IOException, InvalidChangeOperationException, MergeConflictException,
StorageException, PermissionBackendException, ResourceConflictException {
PermissionBackendException, ResourceConflictException {
assertCanEdit(notes);
Optional<ChangeEdit> optionalChangeEdit = lookupChangeEdit(notes);
@@ -391,8 +390,7 @@ public class ChangeEditModifier {
}
private void assertCanEdit(ChangeNotes notes)
throws AuthException, PermissionBackendException, IOException, ResourceConflictException,
StorageException {
throws AuthException, PermissionBackendException, IOException, ResourceConflictException {
if (!currentUser.get().isIdentifiedUser()) {
throw new AuthException("Authentication required");
}
@@ -442,13 +440,12 @@ public class ChangeEditModifier {
return changeEditUtil.byChange(notes);
}
private PatchSet getBasePatchSet(Optional<ChangeEdit> optionalChangeEdit, ChangeNotes notes)
throws StorageException {
private PatchSet getBasePatchSet(Optional<ChangeEdit> optionalChangeEdit, ChangeNotes notes) {
Optional<PatchSet> editBasePatchSet = optionalChangeEdit.map(ChangeEdit::getBasePatchSet);
return editBasePatchSet.isPresent() ? editBasePatchSet.get() : lookupCurrentPatchSet(notes);
}
private PatchSet lookupCurrentPatchSet(ChangeNotes notes) throws StorageException {
private PatchSet lookupCurrentPatchSet(ChangeNotes notes) {
return patchSetUtil.current(notes);
}

View File

@@ -146,7 +146,6 @@ public class ChangeEditUtil {
* @param notify Notify handling that defines to whom email notifications should be sent after the
* change edit is published.
* @throws IOException
* @throws StorageException
* @throws UpdateException
* @throws RestApiException
*/
@@ -156,7 +155,7 @@ public class ChangeEditUtil {
CurrentUser user,
ChangeEdit edit,
NotifyResolver.Result notify)
throws IOException, StorageException, RestApiException, UpdateException {
throws IOException, RestApiException, UpdateException {
Change change = edit.getChange();
try (Repository repo = gitManager.openRepository(change.getProject());
ObjectInserter oi = repo.newObjectInserter();
@@ -210,9 +209,8 @@ public class ChangeEditUtil {
*
* @param edit change edit to delete
* @throws IOException
* @throws StorageException
*/
public void delete(ChangeEdit edit) throws IOException, StorageException {
public void delete(ChangeEdit edit) throws IOException {
Change change = edit.getChange();
try (Repository repo = gitManager.openRepository(change.getProject())) {
deleteRef(repo, edit);

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.events;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.registration.DynamicItem;
import com.google.gerrit.extensions.restapi.AuthException;
import com.google.gerrit.lifecycle.LifecycleModule;
@@ -77,8 +76,7 @@ public class EventBroker implements EventDispatcher {
}
@Override
public void postEvent(Change change, ChangeEvent event)
throws StorageException, PermissionBackendException {
public void postEvent(Change change, ChangeEvent event) throws PermissionBackendException {
fireEvent(change, event);
}
@@ -94,7 +92,7 @@ public class EventBroker implements EventDispatcher {
}
@Override
public void postEvent(Event event) throws StorageException, PermissionBackendException {
public void postEvent(Event event) throws PermissionBackendException {
fireEvent(event);
}
@@ -102,8 +100,7 @@ public class EventBroker implements EventDispatcher {
unrestrictedListeners.runEach(l -> l.onEvent(event));
}
protected void fireEvent(Change change, ChangeEvent event)
throws StorageException, PermissionBackendException {
protected void fireEvent(Change change, ChangeEvent event) throws PermissionBackendException {
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
CurrentUser user = c.call(UserScopedEventListener::getUser);
if (isVisibleTo(change, user)) {
@@ -134,7 +131,7 @@ public class EventBroker implements EventDispatcher {
fireEventForUnrestrictedListeners(event);
}
protected void fireEvent(Event event) throws StorageException, PermissionBackendException {
protected void fireEvent(Event event) throws PermissionBackendException {
for (PluginSetEntryContext<UserScopedEventListener> c : listeners) {
CurrentUser user = c.call(UserScopedEventListener::getUser);
if (isVisibleTo(event, user)) {
@@ -158,8 +155,7 @@ public class EventBroker implements EventDispatcher {
}
}
protected boolean isVisibleTo(Change change, CurrentUser user)
throws StorageException, PermissionBackendException {
protected boolean isVisibleTo(Change change, CurrentUser user) throws PermissionBackendException {
if (change == null) {
return false;
}
@@ -193,8 +189,7 @@ public class EventBroker implements EventDispatcher {
}
}
protected boolean isVisibleTo(Event event, CurrentUser user)
throws StorageException, PermissionBackendException {
protected boolean isVisibleTo(Event event, CurrentUser user) throws PermissionBackendException {
if (event instanceof RefEvent) {
RefEvent refEvent = (RefEvent) event;
String ref = refEvent.getRefName();

View File

@@ -14,7 +14,6 @@
package com.google.gerrit.server.events;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Branch;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
@@ -27,11 +26,9 @@ public interface EventDispatcher {
*
* @param change The change that the event is related to
* @param event The event to post
* @throws StorageException on failure to post the event due to DB error
* @throws PermissionBackendException on failure of permission checks
*/
void postEvent(Change change, ChangeEvent event)
throws StorageException, PermissionBackendException;
void postEvent(Change change, ChangeEvent event) throws PermissionBackendException;
/**
* Post a stream event that is related to a branch
@@ -57,8 +54,7 @@ public interface EventDispatcher {
* specific postEvent methods for those use cases.
*
* @param event The event to post.
* @throws StorageException on failure to post the event due to DB error
* @throws PermissionBackendException on failure of permission checks
*/
void postEvent(Event event) throws StorageException, PermissionBackendException;
void postEvent(Event event) throws PermissionBackendException;
}

View File

@@ -155,8 +155,7 @@ public class EventFactory {
* @param notes
* @return object suitable for serialization to JSON
*/
public ChangeAttribute asChangeAttribute(Change change, ChangeNotes notes)
throws StorageException {
public ChangeAttribute asChangeAttribute(Change change, ChangeNotes notes) {
ChangeAttribute a = asChangeAttribute(change);
Set<String> hashtags = notes.load().getHashtags();
if (!hashtags.isEmpty()) {
@@ -201,7 +200,7 @@ public class EventFactory {
* @param a
* @param notes
*/
public void addAllReviewers(ChangeAttribute a, ChangeNotes notes) throws StorageException {
public void addAllReviewers(ChangeAttribute a, ChangeNotes notes) {
Collection<Account.Id> reviewers = approvalsUtil.getReviewers(notes).all();
if (!reviewers.isEmpty()) {
a.allReviewers = Lists.newArrayListWithCapacity(reviewers.size());
@@ -285,7 +284,7 @@ public class EventFactory {
}
private void addDependsOn(RevWalk rw, ChangeAttribute ca, Change change, PatchSet currentPs)
throws StorageException, IOException {
throws IOException {
RevCommit commit = rw.parseCommit(ObjectId.fromString(currentPs.getRevision().get()));
final List<String> parentNames = new ArrayList<>(commit.getParentCount());
for (RevCommit p : commit.getParents()) {
@@ -318,7 +317,7 @@ public class EventFactory {
}
private void addNeededBy(RevWalk rw, ChangeAttribute ca, Change change, PatchSet currentPs)
throws StorageException, IOException {
throws IOException {
if (currentPs.getGroups().isEmpty()) {
return;
}
@@ -507,7 +506,7 @@ public class EventFactory {
// TODO: The same method exists in PatchSetInfoFactory, find a common place
// for it
private UserIdentity toUserIdentity(PersonIdent who) throws IOException, StorageException {
private UserIdentity toUserIdentity(PersonIdent who) throws IOException {
UserIdentity u = new UserIdentity();
u.setName(who.getName());
u.setEmail(who.getEmailAddress());

View File

@@ -135,7 +135,7 @@ public class StreamEventsApiListener
this.changeNotesFactory = changeNotesFactory;
}
private ChangeNotes getNotes(ChangeInfo info) throws StorageException {
private ChangeNotes getNotes(ChangeInfo info) {
try {
return changeNotesFactory.createChecked(new Change.Id(info._number));
} catch (NoSuchChangeException e) {
@@ -143,7 +143,7 @@ public class StreamEventsApiListener
}
}
private PatchSet getPatchSet(ChangeNotes notes, RevisionInfo info) throws StorageException {
private PatchSet getPatchSet(ChangeNotes notes, RevisionInfo info) {
return psUtil.get(notes, PatchSet.Id.fromRef(info.ref));
}

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.extensions.events;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.client.ListChangesOption;
import com.google.gerrit.extensions.common.AccountInfo;
import com.google.gerrit.extensions.common.ApprovalInfo;
@@ -74,19 +73,17 @@ public class EventUtil {
this.revisionJsonFactory = revisionJsonFactory;
}
public ChangeInfo changeInfo(Change change) throws StorageException {
public ChangeInfo changeInfo(Change change) {
return changeJsonFactory.create(CHANGE_OPTIONS).format(change);
}
public RevisionInfo revisionInfo(Project project, PatchSet ps)
throws StorageException, PatchListNotAvailableException, GpgException, IOException,
PermissionBackendException {
throws PatchListNotAvailableException, GpgException, IOException, PermissionBackendException {
return revisionInfo(project.getNameKey(), ps);
}
public RevisionInfo revisionInfo(Project.NameKey project, PatchSet ps)
throws StorageException, PatchListNotAvailableException, GpgException, IOException,
PermissionBackendException {
throws PatchListNotAvailableException, GpgException, IOException, PermissionBackendException {
ChangeData cd = changeDataFactory.create(project, ps.getId().getParentKey());
return revisionJsonFactory.create(CHANGE_OPTIONS).getRevisionInfo(cd, ps);
}

View File

@@ -28,7 +28,6 @@ import com.google.common.collect.SetMultimap;
import com.google.common.collect.Sets;
import com.google.common.collect.SortedSetMultimap;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.PatchSetUtil;
@@ -89,7 +88,7 @@ public class GroupCollector {
}
private interface Lookup {
List<String> lookup(PatchSet.Id psId) throws StorageException;
List<String> lookup(PatchSet.Id psId);
}
private final ListMultimap<ObjectId, PatchSet.Id> patchSetsBySha;
@@ -198,7 +197,7 @@ public class GroupCollector {
}
}
public SortedSetMultimap<ObjectId, String> getGroups() throws StorageException {
public SortedSetMultimap<ObjectId, String> getGroups() {
done = true;
SortedSetMultimap<ObjectId, String> result =
MultimapBuilder.hashKeys(groups.keySet().size()).treeSetValues().build();
@@ -224,8 +223,7 @@ public class GroupCollector {
return id != null && patchSetsBySha.containsKey(id);
}
private Set<String> resolveGroups(ObjectId forCommit, Collection<String> candidates)
throws StorageException {
private Set<String> resolveGroups(ObjectId forCommit, Collection<String> candidates) {
Set<String> actual = Sets.newTreeSet();
Set<String> done = Sets.newHashSetWithExpectedSize(candidates.size());
Set<String> seen = Sets.newHashSetWithExpectedSize(candidates.size());
@@ -260,7 +258,7 @@ public class GroupCollector {
}
}
private Iterable<String> resolveGroup(ObjectId forCommit, String group) throws StorageException {
private Iterable<String> resolveGroup(ObjectId forCommit, String group) {
ObjectId id = parseGroup(forCommit, group);
if (id != null) {
PatchSet.Id psId = Iterables.getFirst(patchSetsBySha.get(id), null);

View File

@@ -17,7 +17,6 @@ package com.google.gerrit.server.git;
import static java.util.Objects.requireNonNull;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
import com.google.gerrit.reviewdb.client.LabelId;
@@ -105,7 +104,7 @@ public class MergedByPushOp implements BatchUpdateOp {
}
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException, IOException {
public boolean updateChange(ChangeContext ctx) throws IOException {
change = ctx.getChange();
correctBranch = refName.equals(change.getDest().get());
if (!correctBranch) {
@@ -193,7 +192,7 @@ public class MergedByPushOp implements BatchUpdateOp {
change, patchSet, ctx.getAccount(), patchSet.getRevision().get(), ctx.getWhen());
}
private PatchSetInfo getPatchSetInfo(ChangeContext ctx) throws IOException, StorageException {
private PatchSetInfo getPatchSetInfo(ChangeContext ctx) throws IOException {
RevWalk rw = ctx.getRevWalk();
RevCommit commit =
rw.parseCommit(ObjectId.fromString(requireNonNull(patchSet).getRevision().get()));

View File

@@ -18,7 +18,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Throwables;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.BadRequestException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
@@ -87,11 +86,9 @@ public class PureRevertCache {
*
* @return {@code true} if {@code claimedRevert} is a pure (clean) revert.
* @throws IOException if there was a problem with the storage layer
* @throws StorageException if there was a problem with the storage layer
* @throws BadRequestException if there is a problem with the provided {@link ChangeNotes}
*/
public boolean isPureRevert(ChangeNotes claimedRevert)
throws StorageException, IOException, BadRequestException {
public boolean isPureRevert(ChangeNotes claimedRevert) throws IOException, BadRequestException {
if (claimedRevert.getChange().getRevertOf() == null) {
throw new BadRequestException("revertOf not set");
}

View File

@@ -2274,7 +2274,7 @@ class ReceiveCommits {
return newChanges;
}
private boolean foundInExistingRef(Collection<Ref> existingRefs) throws StorageException {
private boolean foundInExistingRef(Collection<Ref> existingRefs) {
for (Ref ref : existingRefs) {
ChangeNotes notes =
notesFactory.create(project.getNameKey(), Change.Id.fromRef(ref.getName()));
@@ -2394,11 +2394,11 @@ class ReceiveCommits {
}
}
private ChangeLookup lookupByChangeKey(RevCommit c, Change.Key key) throws StorageException {
private ChangeLookup lookupByChangeKey(RevCommit c, Change.Key key) {
return new ChangeLookup(c, key, queryProvider.get().byBranchKey(magicBranch.dest, key));
}
private ChangeLookup lookupByCommit(RevCommit c) throws StorageException {
private ChangeLookup lookupByCommit(RevCommit c) {
return new ChangeLookup(
c, null, queryProvider.get().byBranchCommit(magicBranch.dest, c.getName()));
}
@@ -2525,8 +2525,8 @@ class ReceiveCommits {
}
private void submit(Collection<CreateRequest> create, Collection<ReplaceRequest> replace)
throws StorageException, RestApiException, UpdateException, IOException,
ConfigInvalidException, PermissionBackendException {
throws RestApiException, UpdateException, IOException, ConfigInvalidException,
PermissionBackendException {
Map<ObjectId, Change> bySha = Maps.newHashMapWithExpectedSize(create.size() + replace.size());
for (CreateRequest r : create) {
requireNonNull(
@@ -2582,7 +2582,7 @@ class ReceiveCommits {
}
}
private void readChangesForReplace() throws StorageException {
private void readChangesForReplace() {
Collection<ChangeNotes> allNotes =
notesFactory.create(
replaceByChange.values().stream().map(r -> r.ontoChange).collect(toList()));
@@ -2646,10 +2646,9 @@ class ReceiveCommits {
*
* @return whether the new commit is valid
* @throws IOException
* @throws StorageException
* @throws PermissionBackendException
*/
boolean validateNewPatchSet() throws IOException, StorageException, PermissionBackendException {
boolean validateNewPatchSet() throws IOException, PermissionBackendException {
if (!validateNewPatchSetNoteDb()) {
return false;
}
@@ -2670,8 +2669,7 @@ class ReceiveCommits {
return true;
}
boolean validateNewPatchSetForAutoClose()
throws IOException, StorageException, PermissionBackendException {
boolean validateNewPatchSetForAutoClose() throws IOException, PermissionBackendException {
if (!validateNewPatchSetNoteDb()) {
return false;
}
@@ -2681,8 +2679,7 @@ class ReceiveCommits {
}
/** Validates the new PS against permissions and notedb status. */
private boolean validateNewPatchSetNoteDb()
throws IOException, StorageException, PermissionBackendException {
private boolean validateNewPatchSetNoteDb() throws IOException, PermissionBackendException {
if (notes == null) {
reject(inputCommand, "change " + ontoChange + " not found");
return false;
@@ -2845,7 +2842,7 @@ class ReceiveCommits {
}
/** Updates 'this' to add a new patchset. */
private void newPatchSet() throws IOException, StorageException {
private void newPatchSet() throws IOException {
RevCommit newCommit = receivePack.getRevWalk().parseCommit(newCommitId);
psId =
ChangeUtil.nextPatchSetIdFromAllRefsMap(allRefs(), notes.getChange().currentPatchSetId());
@@ -2909,7 +2906,7 @@ class ReceiveCommits {
psId.getParentKey(),
new BatchUpdateOp() {
@Override
public boolean updateChange(ChangeContext ctx) throws StorageException {
public boolean updateChange(ChangeContext ctx) {
PatchSet ps = psUtil.get(ctx.getNotes(), psId);
List<String> oldGroups = ps.getGroups();
if (oldGroups == null) {
@@ -3241,7 +3238,7 @@ class ReceiveCommits {
}
}
private Optional<ChangeNotes> getChangeNotes(Change.Id changeId) throws StorageException {
private Optional<ChangeNotes> getChangeNotes(Change.Id changeId) {
try {
return Optional.of(notesFactory.createChecked(project.getNameKey(), changeId));
} catch (NoSuchChangeException e) {
@@ -3249,7 +3246,7 @@ class ReceiveCommits {
}
}
private <T> T executeIndexQuery(Action<T> action) throws StorageException {
private <T> T executeIndexQuery(Action<T> action) {
try {
return retryHelper.execute(
ActionType.INDEX_QUERY, action, StorageException.class::isInstance);
@@ -3260,8 +3257,7 @@ class ReceiveCommits {
}
}
private Map<Change.Key, ChangeNotes> openChangesByKeyByBranch(Branch.NameKey branch)
throws StorageException {
private Map<Change.Key, ChangeNotes> openChangesByKeyByBranch(Branch.NameKey branch) {
Map<Change.Key, ChangeNotes> r = new HashMap<>();
for (ChangeData cd : queryProvider.get().byBranchOpen(branch)) {
try {

View File

@@ -29,7 +29,6 @@ import com.google.common.collect.Streams;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.Nullable;
import com.google.gerrit.common.data.LabelType;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.AddReviewerInput;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.client.ChangeKind;
@@ -242,8 +241,7 @@ public class ReplaceOp implements BatchUpdateOp {
@Override
public boolean updateChange(ChangeContext ctx)
throws RestApiException, StorageException, IOException, PermissionBackendException,
ConfigInvalidException {
throws RestApiException, IOException, PermissionBackendException, ConfigInvalidException {
notes = ctx.getNotes();
Change change = notes.getChange();
if (change == null || change.isClosed()) {
@@ -387,7 +385,7 @@ public class ReplaceOp implements BatchUpdateOp {
}
private ChangeMessage createChangeMessage(ChangeContext ctx, String reviewMessage)
throws StorageException, IOException {
throws IOException {
String approvalMessage =
ApprovalsUtil.renderMessageWithApprovals(
patchSetId.get(), approvals, scanLabels(ctx, approvals));
@@ -441,7 +439,7 @@ public class ReplaceOp implements BatchUpdateOp {
}
private Map<String, PatchSetApproval> scanLabels(ChangeContext ctx, Map<String, Short> approvals)
throws StorageException, IOException {
throws IOException {
Map<String, PatchSetApproval> current = new HashMap<>();
// We optimize here and only retrieve current when approvals provided
if (!approvals.isEmpty()) {
@@ -485,8 +483,7 @@ public class ReplaceOp implements BatchUpdateOp {
}
}
private List<Comment> publishComments(ChangeContext ctx, boolean workInProgress)
throws StorageException {
private List<Comment> publishComments(ChangeContext ctx, boolean workInProgress) {
List<Comment> comments =
commentsUtil.draftByChangeAuthor(ctx.getNotes(), ctx.getUser().getAccountId());
publishCommentUtil.publish(

View File

@@ -16,7 +16,6 @@ package com.google.gerrit.server.index.account;
import static com.google.common.base.Preconditions.checkState;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.Index;
import com.google.gerrit.index.QueryOptions;
import com.google.gerrit.index.query.DataSource;
@@ -37,7 +36,7 @@ public class IndexedAccountQuery extends IndexedQuery<Account.Id, AccountState>
}
@Override
public boolean match(AccountState accountState) throws StorageException {
public boolean match(AccountState accountState) {
Predicate<AccountState> pred = getChild(0);
checkState(
pred.isMatchable(),

View File

@@ -154,7 +154,7 @@ public class ChangeField {
exact(ChangeQueryBuilder.FIELD_FILE)
.buildRepeatable(cd -> firstNonNull(cd.currentFilePaths(), ImmutableList.of()));
public static Set<String> getFileParts(ChangeData cd) throws StorageException {
public static Set<String> getFileParts(ChangeData cd) {
List<String> paths;
try {
paths = cd.currentFilePaths();
@@ -191,7 +191,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, Iterable<String>> EXTENSION =
exact(ChangeQueryBuilder.FIELD_EXTENSION).buildRepeatable(ChangeField::getExtensions);
public static Set<String> getExtensions(ChangeData cd) throws StorageException {
public static Set<String> getExtensions(ChangeData cd) {
return extensions(cd).collect(toSet());
}
@@ -202,7 +202,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, String> ONLY_EXTENSIONS =
exact(ChangeQueryBuilder.FIELD_ONLY_EXTENSIONS).build(ChangeField::getAllExtensionsAsList);
public static String getAllExtensionsAsList(ChangeData cd) throws StorageException {
public static String getAllExtensionsAsList(ChangeData cd) {
return extensions(cd).distinct().sorted().collect(joining(","));
}
@@ -214,7 +214,7 @@ public class ChangeField {
* <p>If the change contains multiple files with the same extension the extension is returned
* multiple times in the stream (once per file).
*/
private static Stream<String> extensions(ChangeData cd) throws StorageException {
private static Stream<String> extensions(ChangeData cd) {
try {
return cd.currentFilePaths().stream()
// Use case-insensitive file extensions even though other file fields are case-sensitive.
@@ -231,7 +231,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, Iterable<String>> FOOTER =
exact(ChangeQueryBuilder.FIELD_FOOTER).buildRepeatable(ChangeField::getFooters);
public static Set<String> getFooters(ChangeData cd) throws StorageException {
public static Set<String> getFooters(ChangeData cd) {
try {
return cd.commitFooters().stream()
.map(f -> f.toString().toLowerCase(Locale.US))
@@ -245,7 +245,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, Iterable<String>> DIRECTORY =
exact(ChangeQueryBuilder.FIELD_DIRECTORY).buildRepeatable(ChangeField::getDirectories);
public static Set<String> getDirectories(ChangeData cd) throws StorageException {
public static Set<String> getDirectories(ChangeData cd) {
List<String> paths;
try {
paths = cd.currentFilePaths();
@@ -470,7 +470,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, Iterable<String>> EXACT_COMMIT =
exact(ChangeQueryBuilder.FIELD_EXACTCOMMIT).buildRepeatable(ChangeField::getRevisions);
private static Set<String> getRevisions(ChangeData cd) throws StorageException {
private static Set<String> getRevisions(ChangeData cd) {
Set<String> revisions = new HashSet<>();
for (PatchSet ps : cd.patchSets()) {
if (ps.getRevision() != null) {
@@ -489,7 +489,7 @@ public class ChangeField {
public static final FieldDef<ChangeData, Iterable<String>> LABEL =
exact("label2").buildRepeatable(cd -> getLabels(cd, true));
private static Iterable<String> getLabels(ChangeData cd, boolean owners) throws StorageException {
private static Iterable<String> getLabels(ChangeData cd, boolean owners) {
Set<String> allApprovals = new HashSet<>();
Set<String> distinctApprovals = new HashSet<>();
for (PatchSetApproval a : cd.currentApprovals()) {
@@ -506,21 +506,19 @@ public class ChangeField {
return allApprovals;
}
public static Set<String> getAuthorParts(ChangeData cd) throws StorageException, IOException {
public static Set<String> getAuthorParts(ChangeData cd) throws IOException {
return SchemaUtil.getPersonParts(cd.getAuthor());
}
public static Set<String> getAuthorNameAndEmail(ChangeData cd)
throws StorageException, IOException {
public static Set<String> getAuthorNameAndEmail(ChangeData cd) throws IOException {
return getNameAndEmail(cd.getAuthor());
}
public static Set<String> getCommitterParts(ChangeData cd) throws StorageException, IOException {
public static Set<String> getCommitterParts(ChangeData cd) throws IOException {
return SchemaUtil.getPersonParts(cd.getCommitter());
}
public static Set<String> getCommitterNameAndEmail(ChangeData cd)
throws StorageException, IOException {
public static Set<String> getCommitterNameAndEmail(ChangeData cd) throws IOException {
return getNameAndEmail(cd.getCommitter());
}
@@ -856,7 +854,7 @@ public class ChangeField {
return storedSubmitRecords(cd.submitRecords(opts));
}
public static List<String> formatSubmitRecordValues(ChangeData cd) throws StorageException {
public static List<String> formatSubmitRecordValues(ChangeData cd) {
return formatSubmitRecordValues(
cd.submitRecords(SUBMIT_RULE_OPTIONS_STRICT), cd.change().getOwner());
}
@@ -944,7 +942,7 @@ public class ChangeField {
return result;
});
private static String getTopic(ChangeData cd) throws StorageException {
private static String getTopic(ChangeData cd) {
Change c = cd.change();
if (c == null) {
return null;

View File

@@ -22,7 +22,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.IndexConfig;
import com.google.gerrit.index.QueryOptions;
import com.google.gerrit.index.query.DataSource;
@@ -81,7 +80,7 @@ public class IndexedChangeQuery extends IndexedQuery<Change.Id, ChangeData>
}
@Override
public ResultSet<ChangeData> read() throws StorageException {
public ResultSet<ChangeData> read() {
final DataSource<ChangeData> currSource = source;
final ResultSet<ChangeData> rs = currSource.read();
@@ -114,7 +113,7 @@ public class IndexedChangeQuery extends IndexedQuery<Change.Id, ChangeData>
}
@Override
public boolean match(ChangeData cd) throws StorageException {
public boolean match(ChangeData cd) {
if (source != null && fromSource.get(cd) == source) {
return true;
}

View File

@@ -21,7 +21,6 @@ import com.google.common.flogger.FluentLogger;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.events.GitReferenceUpdatedListener;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.reviewdb.client.Branch;
@@ -152,7 +151,7 @@ public class ReindexAfterRefUpdate implements GitReferenceUpdatedListener {
}
@Override
protected List<Change> impl(RequestContext ctx) throws StorageException {
protected List<Change> impl(RequestContext ctx) {
String ref = event.getRefName();
Project.NameKey project = new Project.NameKey(event.getProjectName());
if (ref.equals(RefNames.REFS_CONFIG)) {
@@ -179,7 +178,7 @@ public class ReindexAfterRefUpdate implements GitReferenceUpdatedListener {
}
@Override
protected Void impl(RequestContext ctx) throws StorageException, IOException {
protected Void impl(RequestContext ctx) throws IOException {
// Reload change, as some time may have passed since GetChanges.
try {
Change c =

View File

@@ -18,7 +18,6 @@ import static com.google.gerrit.server.notedb.ReviewerStateInternal.CC;
import static com.google.gerrit.server.notedb.ReviewerStateInternal.REVIEWER;
import com.google.gerrit.common.FooterConstants;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.restapi.UnprocessableEntityException;
import com.google.gerrit.reviewdb.client.Account;
import com.google.gerrit.server.ReviewerSet;
@@ -37,7 +36,7 @@ public class MailUtil {
public static MailRecipients getRecipientsFromFooters(
AccountResolver accountResolver, List<FooterLine> footerLines)
throws StorageException, IOException, ConfigInvalidException {
throws IOException, ConfigInvalidException {
MailRecipients recipients = new MailRecipients();
for (FooterLine footerLine : footerLines) {
try {
@@ -62,7 +61,7 @@ public class MailUtil {
@SuppressWarnings("deprecation")
private static Account.Id toAccountId(AccountResolver accountResolver, String nameOrEmail)
throws StorageException, UnprocessableEntityException, IOException, ConfigInvalidException {
throws UnprocessableEntityException, IOException, ConfigInvalidException {
return accountResolver.resolveByNameOrEmail(nameOrEmail).asUnique().getAccount().getId();
}

View File

@@ -147,7 +147,7 @@ public class MailProcessor {
}
private void processImpl(BatchUpdate.Factory buf, MailMessage message)
throws StorageException, UpdateException, RestApiException, IOException {
throws UpdateException, RestApiException, IOException {
for (Extension<MailFilter> filter : mailFilters) {
if (!filter.getProvider().get().shouldProcessMessage(message)) {
logger.atWarning().log(
@@ -208,7 +208,7 @@ public class MailProcessor {
private void persistComments(
BatchUpdate.Factory buf, MailMessage message, MailMetadata metadata, Account.Id sender)
throws StorageException, UpdateException, RestApiException {
throws UpdateException, RestApiException {
try (ManualRequestContext ctx = oneOffRequestContext.openAs(sender)) {
List<ChangeData> changeDataList =
queryProvider.get().byLegacyChangeId(new Change.Id(metadata.changeNumber));
@@ -283,7 +283,7 @@ public class MailProcessor {
@Override
public boolean updateChange(ChangeContext ctx)
throws StorageException, UnprocessableEntityException, PatchListNotAvailableException {
throws UnprocessableEntityException, PatchListNotAvailableException {
patchSet = psUtil.get(ctx.getNotes(), psId);
notes = ctx.getNotes();
if (patchSet == null) {
@@ -358,7 +358,7 @@ public class MailProcessor {
}
private PatchSet targetPatchSetForComment(
ChangeContext ctx, MailComment mailComment, PatchSet current) throws StorageException {
ChangeContext ctx, MailComment mailComment, PatchSet current) {
if (mailComment.getInReplyTo() != null) {
return psUtil.get(
ctx.getNotes(),
@@ -369,7 +369,7 @@ public class MailProcessor {
private Comment persistentCommentFromMailComment(
ChangeContext ctx, MailComment mailComment, PatchSet patchSetForComment)
throws StorageException, UnprocessableEntityException, PatchListNotAvailableException {
throws UnprocessableEntityException, PatchListNotAvailableException {
String fileName;
// The patch set that this comment is based on is different if this
// comment was sent in reply to a comment on a previous patch set.
@@ -412,7 +412,7 @@ public class MailProcessor {
return "(" + numComments + (numComments > 1 ? " comments)" : " comment)");
}
private Set<String> existingMessageIds(ChangeData cd) throws StorageException {
private Set<String> existingMessageIds(ChangeData cd) {
Set<String> existingMessageIds = new HashSet<>();
cd.messages().stream()
.forEach(

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.account.ProjectWatches.NotifyType;
@@ -31,8 +30,7 @@ public class AbandonedSender extends ReplyToChangeSender {
@Inject
public AbandonedSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "abandon", ChangeEmail.newChangeData(ea, project, id));
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.inject.Inject;
@@ -29,8 +28,7 @@ public class AddReviewerSender extends NewChangeSender {
@Inject
public AddReviewerSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, newChangeData(ea, project, id));
}

View File

@@ -84,7 +84,7 @@ public abstract class ChangeEmail extends NotificationEmail {
protected Set<Account.Id> authors;
protected boolean emailOnlyAuthors;
protected ChangeEmail(EmailArguments ea, String mc, ChangeData cd) throws StorageException {
protected ChangeEmail(EmailArguments ea, String mc, ChangeData cd) {
super(ea, mc, cd.change().getDest());
changeData = cd;
change = cd.change();
@@ -343,8 +343,7 @@ public abstract class ChangeEmail extends NotificationEmail {
}
@Override
protected final Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig)
throws StorageException {
protected final Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig) {
if (!NotifyHandling.ALL.equals(notify.handling())) {
return new Watchers();
}

View File

@@ -119,8 +119,7 @@ public class CommentSender extends ReplyToChangeSender {
CommentsUtil commentsUtil,
@GerritServerConfig Config cfg,
@Assisted Project.NameKey project,
@Assisted Change.Id id)
throws StorageException {
@Assisted Change.Id id) {
super(ea, "comment", newChangeData(ea, project, id));
this.commentsUtil = commentsUtil;
this.incomingEmailEnabled =
@@ -129,7 +128,7 @@ public class CommentSender extends ReplyToChangeSender {
this.replyToAddress = cfg.getString("sendemail", null, "replyToAddress");
}
public void setComments(List<Comment> comments) throws StorageException {
public void setComments(List<Comment> comments) {
inlineComments = comments;
Set<String> paths = new HashSet<>();

View File

@@ -44,8 +44,7 @@ public class CreateChangeSender extends NewChangeSender {
EmailArguments ea,
PermissionBackend permissionBackend,
@Assisted Project.NameKey project,
@Assisted Change.Id id)
throws StorageException {
@Assisted Change.Id id) {
super(ea, newChangeData(ea, project, id));
this.permissionBackend = permissionBackend;
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.mail.Address;
import com.google.gerrit.reviewdb.client.Account;
@@ -42,8 +41,7 @@ public class DeleteReviewerSender extends ReplyToChangeSender {
@Inject
public DeleteReviewerSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "deleteReviewer", newChangeData(ea, project, id));
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.account.ProjectWatches.NotifyType;
@@ -31,8 +30,7 @@ public class DeleteVoteSender extends ReplyToChangeSender {
@Inject
protected DeleteVoteSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "deleteVote", newChangeData(ea, project, id));
}

View File

@@ -38,8 +38,8 @@ public class MergedSender extends ReplyToChangeSender {
private final LabelTypes labelTypes;
@Inject
public MergedSender(EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
public MergedSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "merged", newChangeData(ea, project, id));
labelTypes = changeData.getLabelTypes();
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.mail.Address;
import com.google.gerrit.reviewdb.client.Account;
@@ -33,7 +32,7 @@ public abstract class NewChangeSender extends ChangeEmail {
private final Set<Account.Id> extraCC = new HashSet<>();
private final Set<Address> extraCCByEmail = new HashSet<>();
protected NewChangeSender(EmailArguments ea, ChangeData cd) throws StorageException {
protected NewChangeSender(EmailArguments ea, ChangeData cd) {
super(ea, "newchange", cd);
}

View File

@@ -77,8 +77,7 @@ public abstract class NotificationEmail extends OutgoingEmail {
}
/** Returns all watchers that are relevant */
protected abstract Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig)
throws StorageException;
protected abstract Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig);
/** Add users or email addresses to the TO, CC, or BCC list. */
protected void add(RecipientType type, Watchers.List list) {

View File

@@ -19,7 +19,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.common.data.GroupDescription;
import com.google.gerrit.common.data.GroupReference;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.index.query.Predicate;
import com.google.gerrit.index.query.QueryParseException;
import com.google.gerrit.mail.Address;
@@ -62,8 +61,7 @@ public class ProjectWatch {
}
/** Returns all watchers that are relevant */
public final Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig)
throws StorageException {
public final Watchers getWatchers(NotifyType type, boolean includeWatchersFromNotifyConfig) {
Watchers matching = new Watchers();
Set<Account.Id> projectWatchers = new HashSet<>();
@@ -148,8 +146,7 @@ public class ProjectWatch {
}
}
private void add(Watchers matching, NotifyConfig nc)
throws StorageException, QueryParseException {
private void add(Watchers matching, NotifyConfig nc) throws QueryParseException {
for (GroupReference ref : nc.getGroups()) {
CurrentUser user = new SingleGroupUser(ref.getUUID());
if (filterMatch(user, nc.getFilter())) {
@@ -203,8 +200,7 @@ public class ProjectWatch {
Account.Id accountId,
ProjectWatchKey key,
Set<NotifyType> watchedTypes,
NotifyType type)
throws StorageException {
NotifyType type) {
IdentifiedUser user = args.identifiedUserFactory.create(accountId);
try {
@@ -222,8 +218,7 @@ public class ProjectWatch {
return false;
}
private boolean filterMatch(CurrentUser user, String filter)
throws StorageException, QueryParseException {
private boolean filterMatch(CurrentUser user, String filter) throws QueryParseException {
ChangeQueryBuilder qb;
Predicate<ChangeData> p = null;

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.NotifyHandling;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.reviewdb.client.Account;
@@ -41,8 +40,7 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
@Inject
public ReplacePatchSetSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "newpatchset", newChangeData(ea, project, id));
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.extensions.api.changes.RecipientType;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
@@ -27,8 +26,7 @@ public abstract class ReplyToChangeSender extends ChangeEmail {
T create(Project.NameKey project, Change.Id id);
}
protected ReplyToChangeSender(EmailArguments ea, String mc, ChangeData cd)
throws StorageException {
protected ReplyToChangeSender(EmailArguments ea, String mc, ChangeData cd) {
super(ea, mc, cd);
}

View File

@@ -15,7 +15,6 @@
package com.google.gerrit.server.mail.send;
import com.google.gerrit.exceptions.EmailException;
import com.google.gerrit.exceptions.StorageException;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.server.account.ProjectWatches.NotifyType;
@@ -31,8 +30,7 @@ public class RestoredSender extends ReplyToChangeSender {
@Inject
public RestoredSender(
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id)
throws StorageException {
EmailArguments ea, @Assisted Project.NameKey project, @Assisted Change.Id id) {
super(ea, "restore", ChangeEmail.newChangeData(ea, project, id));
}

Some files were not shown because too many files have changed in this diff Show More