Deprecate
`org.apache.commons.io.output.NullOutputStream.NullOutputStream()` in
favor of `org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM`.
MODIFY
src/changes/changes.xml
src/changes/changes.xml
@@ -140,6 +140,9 @@ The <action> type attribute can be add,update,fix,remove.
<action issue="IO-628" dev="ggregory" type="update" due-to="Allon Mureinik">
Migration to JUnit Jupiter #97.
</action>
+ <action issue="IO-630" dev="ggregory" type="update" due-to="Gary Gregory">
+ Deprecate `org.apache.commons.io.output.NullOutputStream.NullOutputStream()` in favor of `org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM`.
+ </action>
</release>
<release version="2.6" date="2017-10-15" description="Java 7 required, Java 9 supported.">

MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
@@ -298,7 +298,7 @@ public static Checksum checksum(final File file, final Checksum checksum) throws
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
try (InputStream in = new CheckedInputStream(new FileInputStream(file), checksum)) {
- IOUtils.copy(in, new NullOutputStream());
+ IOUtils.copy(in, NullOutputStream.NULL_OUTPUT_STREAM);
}
return checksum;
}

MODIFY
src/main/java/org/apache/commons/io/output/NullOutputStream.java
src/main/java/org/apache/commons/io/output/NullOutputStream.java
*/
public class NullOutputStream extends OutputStream {
+ /**
+ * Deprecated in favor of {@link #NULL_OUTPUT_STREAM}.
+ *
+ * TODO: Will be private in 3.0.
+ *
+ * @deprecated Use {@link #NULL_OUTPUT_STREAM}.
+ */
+ @Deprecated
+ public NullOutputStream() {
+ super();
+ }
+
/**
* A singleton.
*/

MODIFY
src/main/java/org/apache/commons/io/output/NullPrintStream.java
src/main/java/org/apache/commons/io/output/NullPrintStream.java
/**
* Constructs an instance.
*/
- @SuppressWarnings("resource")
public NullPrintStream() {
- super(new NullOutputStream());
+ super(NullOutputStream.NULL_OUTPUT_STREAM);
}
}

MODIFY
src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
src/test/java/org/apache/commons/io/IOUtilsCopyTestCase.java
@@ -83,7 +83,7 @@ public void testCopy_inputStreamToOutputStream() throws Exception {
public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
final long size = (long)Integer.MAX_VALUE + (long)1;
final InputStream in = new NullInputStream(size);
- final OutputStream out = new NullOutputStream();
+ final OutputStream out = NullOutputStream.NULL_OUTPUT_STREAM;
// Test copy() method
assertEquals(-1, IOUtils.copy(in, out));

MODIFY
src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java
src/test/java/org/apache/commons/io/input/CountingInputStreamTest.java
@@ -76,7 +76,7 @@ public void testLargeFiles_IO84() throws Exception {
final long size = (long)Integer.MAX_VALUE + (long)1;
final NullInputStream mock = new NullInputStream(size);
final CountingInputStream cis = new CountingInputStream(mock);
- final OutputStream out = new NullOutputStream();
+ final OutputStream out = NullOutputStream.NULL_OUTPUT_STREAM;
// Test integer methods
IOUtils.copyLarge(cis, out);

MODIFY
src/test/java/org/apache/commons/io/output/CountingOutputStreamTest.java
src/test/java/org/apache/commons/io/output/CountingOutputStreamTest.java
@@ -81,7 +81,7 @@ public void testLargeFiles_IO84() throws Exception {
final long size = (long)Integer.MAX_VALUE + (long)1;
final NullInputStream mock = new NullInputStream(size);
- final OutputStream nos = new NullOutputStream();
+ final OutputStream nos = NullOutputStream.NULL_OUTPUT_STREAM;
final CountingOutputStream cos = new CountingOutputStream(nos);
// Test integer methods

MODIFY
src/test/java/org/apache/commons/io/output/NullOutputStreamTest.java
src/test/java/org/apache/commons/io/output/NullOutputStreamTest.java
@@ -40,7 +40,7 @@ private void process(final NullOutputStream nos) throws IOException {
@Test
public void testNewInstance() throws IOException {
- try (final NullOutputStream nos = new NullOutputStream()) {
+ try (final NullOutputStream nos = NullOutputStream.NULL_OUTPUT_STREAM) {
process(nos);
}
}

[IO-630] Deprecate
`org.apache.commons.io.output.NullOutputStream.NullOutputStream()` in
favor of `org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM`.