Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
index e2f22369f9..d0d0af1511 100644
--- a/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
+++ b/org.eclipse.egit.core.test/src/org/eclipse/egit/core/test/GitTestCase.java
@@ -101,10 +101,14 @@ public abstract class GitTestCase {
byte[] readFully = IO.readFully(file);
FileUtils.delete(file);
FileOutputStream fileOutputStream = new FileOutputStream(file);
- byte[] truncatedData = new byte[readFully.length - 1];
- System.arraycopy(readFully, 0, truncatedData, 0, truncatedData.length);
- fileOutputStream.write(truncatedData);
- fileOutputStream.close();
+ try {
+ byte[] truncatedData = new byte[readFully.length - 1];
+ System.arraycopy(readFully, 0, truncatedData, 0,
+ truncatedData.length);
+ fileOutputStream.write(truncatedData);
+ } finally {
+ fileOutputStream.close();
+ }
return id;
}
}

Back to the top