Fix FindBUgs.
MODIFY
src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java
src/main/java/org/apache/commons/io/output/ByteArrayOutputStream.java
@@ -147,12 +147,11 @@ public static InputStream toBufferedInputStream(final InputStream input)
*/
public static InputStream toBufferedInputStream(final InputStream input, final int size)
throws IOException {
- // It does not matter if a ByteArrayOutputStream is not closed as close() is a no-op
- @SuppressWarnings("resource")
- final ByteArrayOutputStream output = new ByteArrayOutputStream(size);
+ try (final ByteArrayOutputStream output = new ByteArrayOutputStream(size)) {
output.write(input);
return output.toInputStream();
}
+ }
@Override
public synchronized InputStream toInputStream() {

Fix FindBUgs.