LabelNormalizer: Remove unused fields and exceptions

Change-Id: Id9fa759b5d38eb15113184f8d56df5df37f432ec
This commit is contained in:
Dave Borowitz 2017-10-20 12:39:06 -04:00
parent 98ac8903f3
commit a19eb4eff1
3 changed files with 6 additions and 20 deletions

View File

@ -31,7 +31,6 @@ import com.google.gerrit.server.change.ChangeKindCache;
import com.google.gerrit.server.git.LabelNormalizer;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.notedb.NoteDbChangeState.PrimaryStorage;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.project.ProjectCache;
import com.google.gerrit.server.project.ProjectState;
import com.google.gerrit.server.query.change.ChangeData;
@ -213,7 +212,7 @@ public class ApprovalCopier {
}
}
return labelNormalizer.normalize(notes, user, byUser.values()).getNormalized();
} catch (IOException | PermissionBackendException e) {
} catch (IOException e) {
throw new OrmException(e);
}
}

View File

@ -26,16 +26,12 @@ import com.google.gerrit.common.data.LabelTypes;
import com.google.gerrit.common.data.LabelValue;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.PatchSetApproval;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.IdentifiedUser;
import com.google.gerrit.server.notedb.ChangeNotes;
import com.google.gerrit.server.permissions.PermissionBackend;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.project.ProjectCache;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
import java.io.IOException;
import java.util.Collection;
@ -75,20 +71,12 @@ public class LabelNormalizer {
}
}
private final Provider<ReviewDb> db;
private final IdentifiedUser.GenericFactory userFactory;
private final PermissionBackend permissionBackend;
private final ProjectCache projectCache;
@Inject
LabelNormalizer(
Provider<ReviewDb> db,
IdentifiedUser.GenericFactory userFactory,
PermissionBackend permissionBackend,
ProjectCache projectCache) {
this.db = db;
LabelNormalizer(IdentifiedUser.GenericFactory userFactory, ProjectCache projectCache) {
this.userFactory = userFactory;
this.permissionBackend = permissionBackend;
this.projectCache = projectCache;
}
@ -100,7 +88,7 @@ public class LabelNormalizer {
* @throws OrmException
*/
public Result normalize(ChangeNotes notes, Collection<PatchSetApproval> approvals)
throws OrmException, PermissionBackendException, IOException {
throws OrmException, IOException {
IdentifiedUser user = userFactory.create(notes.getChange().getOwner());
return normalize(notes, user, approvals);
}
@ -114,7 +102,7 @@ public class LabelNormalizer {
*/
public Result normalize(
ChangeNotes notes, CurrentUser user, Collection<PatchSetApproval> approvals)
throws PermissionBackendException, IOException {
throws IOException {
List<PatchSetApproval> unchanged = Lists.newArrayListWithCapacity(approvals.size());
List<PatchSetApproval> updated = Lists.newArrayListWithCapacity(approvals.size());
List<PatchSetApproval> deleted = Lists.newArrayListWithCapacity(approvals.size());

View File

@ -45,7 +45,6 @@ import com.google.gerrit.server.git.MergeUtil;
import com.google.gerrit.server.git.ProjectConfig;
import com.google.gerrit.server.git.SubmoduleException;
import com.google.gerrit.server.notedb.ChangeUpdate;
import com.google.gerrit.server.permissions.PermissionBackendException;
import com.google.gerrit.server.project.ProjectState;
import com.google.gerrit.server.update.BatchUpdateOp;
import com.google.gerrit.server.update.ChangeContext;
@ -330,7 +329,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
}
private void setApproval(ChangeContext ctx, IdentifiedUser user)
throws OrmException, IOException, PermissionBackendException {
throws OrmException, IOException {
Change.Id id = ctx.getChange().getId();
List<SubmitRecord> records = args.commitStatus.getSubmitRecords(id);
PatchSet.Id oldPsId = toMerge.getPatchsetId();
@ -352,7 +351,7 @@ abstract class SubmitStrategyOp implements BatchUpdateOp {
}
private LabelNormalizer.Result approve(ChangeContext ctx, ChangeUpdate update)
throws OrmException, IOException, PermissionBackendException {
throws OrmException, IOException {
PatchSet.Id psId = update.getPatchSetId();
Map<PatchSetApproval.Key, PatchSetApproval> byKey = new HashMap<>();
for (PatchSetApproval psa :