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/src/org/eclipse/jgit/util/io | |
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/src/org/eclipse/jgit/util/io')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/io/SafeBufferedOutputStream.java | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/SafeBufferedOutputStream.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/SafeBufferedOutputStream.java index 68f250da09..84c339889b 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/SafeBufferedOutputStream.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/SafeBufferedOutputStream.java @@ -43,20 +43,13 @@ package org.eclipse.jgit.util.io; import java.io.BufferedOutputStream; -import java.io.IOException; import java.io.OutputStream; /** - * A BufferedOutputStream that throws an error if the final flush fails on - * close. - * <p> - * Java's BufferedOutputStream swallows errors that occur when the output stream - * tries to write the final bytes to the output during close. This may result in - * corrupted files without notice. - * </p> + * @deprecated use BufferedOutputStream in Java 8 and later. */ +@Deprecated public class SafeBufferedOutputStream extends BufferedOutputStream { - /** * @see BufferedOutputStream#BufferedOutputStream(OutputStream) * @param out @@ -76,13 +69,4 @@ public class SafeBufferedOutputStream extends BufferedOutputStream { public SafeBufferedOutputStream(OutputStream out, int size) { super(out, size); } - - @Override - public void close() throws IOException { - try { - flush(); - } finally { - super.close(); - } - } } |