aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java12
1 files changed, 4 insertions, 8 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
index d1e2770931..af09f65f17 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RemoveNoteCommand.java
@@ -81,11 +81,10 @@ public class RemoveNoteCommand extends GitCommand<Note> {
public Note call() throws GitAPIException {
checkCallable();
- RevWalk walk = new RevWalk(repo);
- ObjectInserter inserter = repo.newObjectInserter();
- NoteMap map = NoteMap.newEmptyMap();
- RevCommit notesCommit = null;
- try {
+ try (RevWalk walk = new RevWalk(repo);
+ ObjectInserter inserter = repo.newObjectInserter()) {
+ NoteMap map = NoteMap.newEmptyMap();
+ RevCommit notesCommit = null;
Ref ref = repo.getRef(notesRef);
// if we have a notes ref, use it
if (ref != null) {
@@ -98,9 +97,6 @@ public class RemoveNoteCommand extends GitCommand<Note> {
return map.getNote(id);
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
- } finally {
- inserter.release();
- walk.release();
}
}