aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 20:17:32 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-05 20:17:32 +0900
commit40868386dbe9da7c3eb23f6495a655f536f8a14b (patch)
tree15ead0d97f6036f51f5e8f3ca3ac392a5f76e63c /org.eclipse.jgit
parente1c1b80c93658e45c8500c12d7ab12a9af7a2358 (diff)
downloadjgit-40868386dbe9da7c3eb23f6495a655f536f8a14b.tar.gz
jgit-40868386dbe9da7c3eb23f6495a655f536f8a14b.zip
ApplyCommand: Open FileWriter in try-with-resource
Change-Id: Ia473f74dc4608fc43edd57eda4f193c226e9004d 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/api/ApplyCommand.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
index cfc55d8cc6..5b84032b15 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ApplyCommand.java
@@ -258,9 +258,9 @@ public class ApplyCommand extends GitCommand<ApplyResult> {
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
- FileWriter fw = new FileWriter(f);
- fw.write(sb.toString());
- fw.close();
+ try (FileWriter fw = new FileWriter(f)) {
+ fw.write(sb.toString());
+ }
getRepository().getFS().setExecute(f, fh.getNewMode() == FileMode.EXECUTABLE_FILE);
}