summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
index e88e7a38c6..a07a4fd1a5 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/IO.java
@@ -203,12 +203,13 @@ public class IO {
if (last < 0)
return ByteBuffer.wrap(out, 0, pos);
- @SuppressWarnings("resource" /* java 7 */)
- TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE);
- tmp.write(out);
- tmp.write(last);
- tmp.copy(in);
- return ByteBuffer.wrap(tmp.toByteArray());
+ try (TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(
+ Integer.MAX_VALUE)) {
+ tmp.write(out);
+ tmp.write(last);
+ tmp.copy(in);
+ return ByteBuffer.wrap(tmp.toByteArray());
+ }
}
/**