Migrate more callers to ChangeNotes.Factory#createChecked

Change-Id: I9e570251ca845d0c4a3edbc9dfb7e17b743824b5
Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
Edwin Kempin
2016-02-23 11:44:30 +01:00
parent 7b0cd9d7d0
commit 9219e33eab
6 changed files with 54 additions and 38 deletions

View File

@@ -30,6 +30,7 @@ import com.google.gerrit.reviewdb.client.RefNames;
import com.google.gerrit.reviewdb.server.ReviewDb;
import com.google.gerrit.server.git.GitRepositoryManager;
import com.google.gerrit.server.git.GroupCollector;
import com.google.gerrit.server.project.NoSuchChangeException;
import com.google.gwtorm.server.OrmException;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -75,7 +76,7 @@ public class Schema_108 extends SchemaVersion {
try (Repository repo = repoManager.openRepository(e.getKey());
RevWalk rw = new RevWalk(repo)) {
updateProjectGroups(db, repo, rw, (Set<Change.Id>) e.getValue(), ui);
} catch (IOException err) {
} catch (IOException | NoSuchChangeException err) {
throw new OrmException(err);
}
if (++i % 100 == 0) {
@@ -85,9 +86,9 @@ public class Schema_108 extends SchemaVersion {
ui.message("done");
}
private void updateProjectGroups(ReviewDb db, Repository repo,
RevWalk rw, Set<Change.Id> changes, UpdateUI ui)
throws OrmException, IOException {
private void updateProjectGroups(ReviewDb db, Repository repo, RevWalk rw,
Set<Change.Id> changes, UpdateUI ui)
throws OrmException, IOException, NoSuchChangeException {
// Match sorting in ReceiveCommits.
rw.reset();
rw.sort(RevSort.TOPO);
@@ -131,7 +132,8 @@ public class Schema_108 extends SchemaVersion {
}
private static void updateGroups(ReviewDb db, GroupCollector collector,
Multimap<ObjectId, PatchSet.Id> patchSetsBySha) throws OrmException {
Multimap<ObjectId, PatchSet.Id> patchSetsBySha)
throws OrmException, NoSuchChangeException {
Map<PatchSet.Id, PatchSet> patchSets =
db.patchSets().toMap(db.patchSets().get(patchSetsBySha.values()));
for (Map.Entry<ObjectId, Collection<String>> e