aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java5
1 files changed, 1 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index 42ca248459..c43037ea0e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -1946,11 +1946,8 @@ public abstract class Repository implements AutoCloseable {
private void writeCommitMsg(File msgFile, String msg) throws IOException {
if (msg != null) {
- FileOutputStream fos = new FileOutputStream(msgFile);
- try {
+ try (FileOutputStream fos = new FileOutputStream(msgFile)) {
fos.write(msg.getBytes(Constants.CHARACTER_ENCODING));
- } finally {
- fos.close();
}
} else {
FileUtils.delete(msgFile, FileUtils.SKIP_MISSING);