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 2022/06/14 22:50:34 UTC

[commons-io] branch master updated: Reuse IOUtils.consume() which also avoids a PMD empty loop body error.

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 4947b573 Reuse IOUtils.consume() which also avoids a PMD empty loop body error.
4947b573 is described below

commit 4947b5735a97f965bf37da1c296398cd17664ec5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 14 18:50:29 2022 -0400

    Reuse IOUtils.consume() which also avoids a PMD empty loop body error.
---
 src/main/java/org/apache/commons/io/input/ObservableInputStream.java | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
index d57eb058..b0f64821 100644
--- a/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/ObservableInputStream.java
@@ -169,10 +169,7 @@ public class ObservableInputStream extends ProxyInputStream {
      * @throws IOException The underlying {@link InputStream}, or either of the observers has thrown an exception.
      */
     public void consume() throws IOException {
-        final byte[] buffer = IOUtils.byteArray();
-        while (read(buffer) != EOF) {
-            // empty
-        }
+        IOUtils.consume(this);
     }
 
     /**