diff options
author | Shawn Pearce <spearce@spearce.org> | 2016-11-13 11:24:41 -0800 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2016-11-14 15:33:54 -0800 |
commit | 8208da2f59ca13d93bd396e2f8189b0fefdb764d (patch) | |
tree | f9dad738be25b1d733e30010665264e22bf3b803 /org.eclipse.jgit.junit | |
parent | 3e522526229ed304aa603ed5a38298971ceea464 (diff) | |
download | jgit-8208da2f59ca13d93bd396e2f8189b0fefdb764d.tar.gz jgit-8208da2f59ca13d93bd396e2f8189b0fefdb764d.zip |
Deprecate SafeBufferedOutputStream
Java 8 fixed the silent flush during close issue by
FilterOutputStream (base class of BufferedOutputStream)
using try-with-resources to close the stream, getting a
behavior matching what JGit's SafeBufferedOutputStream
was doing:
try {
flush();
} finally {
out.close();
}
With Java 8 as the minimum required version to run JGit
it is no longer necessary to override close() or have
this class. Deprecate the class, and use the JRE's version
of close.
Change-Id: Ic0584c140010278dbe4062df2e71be5df9a797b3
Diffstat (limited to 'org.eclipse.jgit.junit')
-rw-r--r-- | org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index 0a2345f088..a44e999378 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.junit; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -103,7 +104,6 @@ import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.filter.PathFilterGroup; import org.eclipse.jgit.util.ChangeIdUtil; import org.eclipse.jgit.util.FileUtils; -import org.eclipse.jgit.util.io.SafeBufferedOutputStream; /** * Wrapper to make creating test data easier. @@ -885,14 +885,14 @@ public class TestRepository<R extends Repository> { pack = nameFor(odb, name, ".pack"); try (OutputStream out = - new SafeBufferedOutputStream(new FileOutputStream(pack))) { + new BufferedOutputStream(new FileOutputStream(pack))) { pw.writePack(m, m, out); } pack.setReadOnly(); idx = nameFor(odb, name, ".idx"); try (OutputStream out = - new SafeBufferedOutputStream(new FileOutputStream(idx))) { + new BufferedOutputStream(new FileOutputStream(idx))) { pw.writeIndex(out); } idx.setReadOnly(); |