ChangeRebuilderImpl: Ignore invalid author when getting hashtags
This can happen when processing a commit by the InternalUser. Such a
user can't set hashtags, so this is safe to ignore.
Change-Id: Ie609cdf34a1532695a64d9b2ffe41a2dbb5880db
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeRebuilderImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeRebuilderImpl.java
index b332967..c7aca4a 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeRebuilderImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/notedb/ChangeRebuilderImpl.java
@@ -225,7 +225,7 @@
}
private void buildUpdates(NoteDbUpdateManager manager, ChangeBundle bundle)
- throws IOException, OrmException, ConfigInvalidException {
+ throws IOException, OrmException {
Change change = new Change(bundle.getChange());
// We will rebuild all events, except for draft comments, in buckets based
// on author and timestamp.
@@ -366,7 +366,7 @@
}
private List<HashtagsEvent> getHashtagsEvents(Change change,
- NoteDbUpdateManager manager) throws IOException, ConfigInvalidException {
+ NoteDbUpdateManager manager) throws IOException {
String refName = ChangeNoteUtil.changeRefName(change.getId());
ObjectId old = manager.getChangeRepo().getObjectId(refName);
if (old == null) {
@@ -378,8 +378,13 @@
rw.reset();
rw.markStart(rw.parseCommit(old));
for (RevCommit commit : rw) {
- Account.Id authorId =
- changeNoteUtil.parseIdent(commit.getAuthorIdent(), change.getId());
+ Account.Id authorId;
+ try {
+ authorId =
+ changeNoteUtil.parseIdent(commit.getAuthorIdent(), change.getId());
+ } catch (ConfigInvalidException e) {
+ continue; // Corrupt data, no valid hashtags in this commit.
+ }
PatchSet.Id psId = parsePatchSetId(change, commit);
Set<String> hashtags = parseHashtags(commit);
if (authorId == null || psId == null || hashtags == null) {