You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/21 16:43:18 UTC
[commons-io] branch master updated: Add @SuppressWarnings with
comments.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push:
new 8a3915b Add @SuppressWarnings with comments.
8a3915b is described below
commit 8a3915b9464db71b0dffbae15e2d619e65cf31af
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 21 11:43:13 2021 -0500
Add @SuppressWarnings with comments.
---
.../org/apache/commons/io/output/AbstractByteArrayOutputStream.java | 1 +
src/main/java/org/apache/commons/io/output/DemuxOutputStream.java | 1 +
.../java/org/apache/commons/io/output/ThresholdingOutputStream.java | 4 ++++
3 files changed, 6 insertions(+)
diff --git a/src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java b/src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java
index c208c26..76f933a 100644
--- a/src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/AbstractByteArrayOutputStream.java
@@ -303,6 +303,7 @@ public abstract class AbstractByteArrayOutputStream extends OutputStream {
* @see #reset()
* @since 2.7
*/
+ @SuppressWarnings("resource") // The result InputStream MUIST be managed by the call site.
protected <T extends InputStream> InputStream toInputStream(
final InputStreamConstructor<T> isConstructor) {
int remaining = count;
diff --git a/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java b/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java
index acf0f0b..0b43020 100644
--- a/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/DemuxOutputStream.java
@@ -47,6 +47,7 @@ public class DemuxOutputStream extends OutputStream {
* @throws IOException
* if an error occurs
*/
+ @SuppressWarnings("resource") // we actually close the stream here
@Override
public void close() throws IOException {
IOUtils.close(outputStreamThreadLocal.get());
diff --git a/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java b/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
index 8170cea..1639412 100644
--- a/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
+++ b/src/main/java/org/apache/commons/io/output/ThresholdingOutputStream.java
@@ -69,6 +69,7 @@ public abstract class ThresholdingOutputStream extends OutputStream {
*
* @throws IOException if an error occurs.
*/
+ @SuppressWarnings("resource") // the underlying stream is managed by a subclass.
@Override
public void write(final int b) throws IOException {
checkThreshold(1);
@@ -83,6 +84,7 @@ public abstract class ThresholdingOutputStream extends OutputStream {
*
* @throws IOException if an error occurs.
*/
+ @SuppressWarnings("resource") // the underlying stream is managed by a subclass.
@Override
public void write(final byte[] b) throws IOException {
checkThreshold(b.length);
@@ -99,6 +101,7 @@ public abstract class ThresholdingOutputStream extends OutputStream {
*
* @throws IOException if an error occurs.
*/
+ @SuppressWarnings("resource") // the underlying stream is managed by a subclass.
@Override
public void write(final byte[] b, final int off, final int len) throws IOException {
checkThreshold(len);
@@ -111,6 +114,7 @@ public abstract class ThresholdingOutputStream extends OutputStream {
*
* @throws IOException if an error occurs.
*/
+ @SuppressWarnings("resource") // the underlying stream is managed by a subclass.
@Override
public void flush() throws IOException {
getStream().flush();