Fix reviewnotes export
Bug: Issue 5652
Change-Id: Ib3dfb89ed32c39c449a0e4bfba79c1549a196583
Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java
index bcb8fe6..e62e1fc 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java
@@ -17,6 +17,7 @@
import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableListMultimap;
import com.google.common.collect.ListMultimap;
+import com.google.common.collect.MultimapBuilder;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.Project;
import com.google.gerrit.reviewdb.server.ReviewDb;
@@ -78,12 +79,13 @@
private ListMultimap<Project.NameKey, ChangeNotes> mergedChanges() {
try (ReviewDb db = database.open()) {
- return notesFactory.create(db, new Predicate<ChangeNotes>() {
- @Override
- public boolean apply(ChangeNotes notes) {
- return notes.getChange().getStatus() == Change.Status.MERGED;
- }
- });
+ return MultimapBuilder.hashKeys().arrayListValues()
+ .build(notesFactory.create(db, new Predicate<ChangeNotes>() {
+ @Override
+ public boolean apply(ChangeNotes notes) {
+ return notes.getChange().getStatus() == Change.Status.MERGED;
+ }
+ }));
} catch (OrmException | IOException e) {
stderr.println("Cannot read changes from database " + e.getMessage());
return ImmutableListMultimap.of();