Browse Source

Use try-with-resources to fix warnings in AddNoteCommand

Replaces use of deprecated release() methods.

Change-Id: I0211bcf0a76a2fccc2c85fa74778e20c256984ba
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.1
Matthias Sohn 10 years ago
parent
commit
3206f37cc3
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java

8
org.eclipse.jgit/src/org/eclipse/jgit/api/AddNoteCommand.java

@ -83,11 +83,10 @@ public class AddNoteCommand 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()) {
Ref ref = repo.getRef(notesRef);
// if we have a notes ref, use it
if (ref != null) {
@ -100,9 +99,6 @@ public class AddNoteCommand extends GitCommand<Note> {
return map.getNote(id);
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);
} finally {
inserter.release();
walk.release();
}
}

Loading…
Cancel
Save