Convert to AutoCloseable RevWalk
Change-Id: Ife7dc6a92c377947de85eba800fd3c5aaaf893ef
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
index cc6abaa..6c2f16d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
@@ -157,14 +157,13 @@
}
}
} finally {
- rw.release();
+ rw.close();
}
}
void createNotes(List<Change> changes, ProgressMonitor monitor)
throws OrmException, IOException {
- RevWalk rw = new RevWalk(git);
- try {
+ try (RevWalk rw = new RevWalk(git)) {
if (monitor == null) {
monitor = NullProgressMonitor.INSTANCE;
}
@@ -177,8 +176,6 @@
getNotes().set(commitId, createNoteContent(ps));
getMessage().append("* ").append(commit.getShortMessage()).append("\n");
}
- } finally {
- rw.release();
}
}
@@ -194,7 +191,7 @@
message.toString());
} finally {
if (inserter != null) {
- inserter.release();
+ inserter.close();
}
}
}