Merge branch 'stable-2.10' into stable-2.11
* stable-2.10:
Adapt to the JGit v4.0.0.201506090130-r
Change-Id: I5e32cbb3e1143eec973df81de23e8df2aa3e6a6b
diff --git a/.gitignore b/.gitignore
index 80d6257..47617be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,6 @@
/.project
/.settings/org.maven.ide.eclipse.prefs
/.settings/org.eclipse.m2e.core.prefs
+/.buckd
+/buck-cache
+/buck-out
diff --git a/BUCK b/BUCK
index 9b7fa54..b766ae2 100644
--- a/BUCK
+++ b/BUCK
@@ -3,6 +3,7 @@
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
manifest_entries = [
+ 'Gerrit-PluginName: reviewnotes',
'Gerrit-Module: com.googlesource.gerrit.plugins.reviewnotes.ReviewNotesModule',
'Gerrit-SshModule: com.googlesource.gerrit.plugins.reviewnotes.SshModule'
]
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 58393fb..6c2f16d 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/CreateReviewNotes.java
@@ -163,8 +163,7 @@
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.close();
}
}
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 264cb16..379f923 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewnotes/ExportReviewNotes.java
@@ -91,13 +91,12 @@
}
private Map<Project.NameKey, List<Change>> cluster(List<Change> changes) {
- HashMap<Project.NameKey, List<Change>> m =
- new HashMap<Project.NameKey, List<Change>>();
+ HashMap<Project.NameKey, List<Change>> m = new HashMap<>();
for (Change change : changes) {
if (change.getStatus() == Change.Status.MERGED) {
List<Change> l = m.get(change.getProject());
if (l == null) {
- l = new BlockList<Change>();
+ l = new BlockList<>();
m.put(change.getProject(), l);
}
l.add(change);
@@ -109,7 +108,7 @@
}
private void export(ReviewDb db, Project.NameKey project, List<Change> changes)
- throws IOException, OrmException, InterruptedException {
+ throws IOException, OrmException {
final Repository git;
try {
git = gitManager.openRepository(project);
@@ -170,11 +169,7 @@
if (next != null) {
try {
export(db, next.getKey(), next.getValue());
- } catch (IOException e) {
- stderr.print(e.getMessage());
- } catch (OrmException e) {
- stderr.print(e.getMessage());
- } catch (InterruptedException e) {
+ } catch (OrmException | IOException e) {
stderr.print(e.getMessage());
}
} else {