Skip to content

Commit 8a3915b

Browse files
author
Gary Gregory
committed
Add @SuppressWarnings with comments.
1 parent 6d0059e commit 8a3915b

3 files changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ protected void writeToImpl(final OutputStream out) throws IOException {
303303
* @see #reset()
304304
* @since 2.7
305305
*/
306+
@SuppressWarnings("resource") // The result InputStream MUIST be managed by the call site.
306307
protected <T extends InputStream> InputStream toInputStream(
307308
final InputStreamConstructor<T> isConstructor) {
308309
int remaining = count;

src/main/java/org/apache/commons/io/output/DemuxOutputStream.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public OutputStream bindStream(final OutputStream output) {
4747
* @throws IOException
4848
* if an error occurs
4949
*/
50+
@SuppressWarnings("resource") // we actually close the stream here
5051
@Override
5152
public void close() throws IOException {
5253
IOUtils.close(outputStreamThreadLocal.get());

src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public ThresholdingOutputStream(final int threshold) {
6969
*
7070
* @throws IOException if an error occurs.
7171
*/
72+
@SuppressWarnings("resource") // the underlying stream is managed by a subclass.
7273
@Override
7374
public void write(final int b) throws IOException {
7475
checkThreshold(1);
@@ -83,6 +84,7 @@ public void write(final int b) throws IOException {
8384
*
8485
* @throws IOException if an error occurs.
8586
*/
87+
@SuppressWarnings("resource") // the underlying stream is managed by a subclass.
8688
@Override
8789
public void write(final byte[] b) throws IOException {
8890
checkThreshold(b.length);
@@ -99,6 +101,7 @@ public void write(final byte[] b) throws IOException {
99101
*
100102
* @throws IOException if an error occurs.
101103
*/
104+
@SuppressWarnings("resource") // the underlying stream is managed by a subclass.
102105
@Override
103106
public void write(final byte[] b, final int off, final int len) throws IOException {
104107
checkThreshold(len);
@@ -111,6 +114,7 @@ public void write(final byte[] b, final int off, final int len) throws IOExcepti
111114
*
112115
* @throws IOException if an error occurs.
113116
*/
117+
@SuppressWarnings("resource") // the underlying stream is managed by a subclass.
114118
@Override
115119
public void flush() throws IOException {
116120
getStream().flush();

0 commit comments

Comments
 (0)