diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java index 3460913e9..bc23dcce2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java @@ -221,8 +221,7 @@ public class LockFile { public void copyCurrentContent() throws IOException { requireLock(); try { - final FileInputStream fis = new FileInputStream(ref); - try { + try (FileInputStream fis = new FileInputStream(ref)) { if (fsync) { FileChannel in = fis.getChannel(); long pos = 0; @@ -238,8 +237,6 @@ public class LockFile { while ((r = fis.read(buf)) >= 0) os.write(buf, 0, r); } - } finally { - fis.close(); } } catch (FileNotFoundException fnfe) { if (ref.exists()) {