diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:14:19 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:14:19 +0900 |
commit | 336add10c125bfc987ad20269147c30da4a86d7d (patch) | |
tree | 1faa5c2cd6b20987372b234752b4b8007940df38 /org.eclipse.jgit | |
parent | fabd645fad4bb3a0f17075dcace1e16dafa4be14 (diff) | |
download | jgit-336add10c125bfc987ad20269147c30da4a86d7d.tar.gz jgit-336add10c125bfc987ad20269147c30da4a86d7d.zip |
FetchProcess: Open OutputStreamWriter in try-with-resource
Change-Id: Ide7768882a95f9e9706e50ca0774edd428dd07c1
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java index dd26fe59ad..fdb5adf94e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/FetchProcess.java @@ -318,14 +318,12 @@ class FetchProcess { final LockFile lock = new LockFile(new File(meta, "FETCH_HEAD")); //$NON-NLS-1$ try { if (lock.lock()) { - final Writer w = new OutputStreamWriter(lock.getOutputStream()); - try { + try (Writer w = new OutputStreamWriter( + lock.getOutputStream())) { for (final FetchHeadRecord h : fetchHeadUpdates) { h.write(w); result.add(h); } - } finally { - w.close(); } lock.commit(); } |