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 2020/09/03 12:28:12 UTC

[commons-io] branch master updated (2e51ec0 -> d0e8c21)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-io.git.


    from 2e51ec0  In-line local var. Javadoc: Close paragraph tags. Format nits.
     new a65adce  Javadoc.
     new ec961e5  Javadoc.
     new d0e8c21  - Javadoc. - Add @SuppressWarnings("resource") for parameter null checks. - Better private method name. - Format nits.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/apache/commons/io/IOExceptionList.java |  4 ++--
 src/main/java/org/apache/commons/io/IOUtils.java         |  4 ++++
 .../org/apache/commons/io/input/DemuxInputStream.java    |  4 ++--
 .../io/input/UnsynchronizedByteArrayInputStream.java     |  3 +++
 .../org/apache/commons/io/input/XmlStreamReader.java     | 16 +++++++++-------
 5 files changed, 20 insertions(+), 11 deletions(-)


[commons-io] 01/03: Javadoc.

Posted by gg...@apache.org.
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

commit a65adce3689490d3da6532760696de1b61aaf3b8
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 3 08:13:40 2020 -0400

    Javadoc.
---
 .../apache/commons/io/input/UnsynchronizedByteArrayInputStream.java    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java b/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
index 82fb881..2f20c6b 100644
--- a/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/UnsynchronizedByteArrayInputStream.java
@@ -31,6 +31,9 @@ import static java.lang.Math.min;
 //@NotThreadSafe
 public class UnsynchronizedByteArrayInputStream extends InputStream {
 
+    /**
+     * The end of stream marker.
+     */
     public static final int END_OF_STREAM = -1;
 
     /**


[commons-io] 03/03: - Javadoc. - Add @SuppressWarnings("resource") for parameter null checks. - Better private method name. - Format nits.

Posted by gg...@apache.org.
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

commit d0e8c210e84677e826f6ad0a3fe30e6c4b9caef7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 3 08:28:04 2020 -0400

    - Javadoc.
    - Add @SuppressWarnings("resource") for parameter null checks.
    - Better private method name.
    - Format nits.
---
 src/main/java/org/apache/commons/io/IOExceptionList.java    |  4 ++--
 src/main/java/org/apache/commons/io/IOUtils.java            |  4 ++++
 .../java/org/apache/commons/io/input/DemuxInputStream.java  |  4 ++--
 .../java/org/apache/commons/io/input/XmlStreamReader.java   | 13 ++++++-------
 4 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/IOExceptionList.java b/src/main/java/org/apache/commons/io/IOExceptionList.java
index 5cb2c74..1d27d88 100644
--- a/src/main/java/org/apache/commons/io/IOExceptionList.java
+++ b/src/main/java/org/apache/commons/io/IOExceptionList.java
@@ -57,7 +57,7 @@ public class IOExceptionList extends IOException {
     }
 
     /**
-     * Gets the cause list.
+     * Gets the cause exception at the given index.
      *
      * @param <T> type of exception to return.
      * @param index index in the cause list.
@@ -68,7 +68,7 @@ public class IOExceptionList extends IOException {
     }
 
     /**
-     * Gets the cause list.
+     * Gets the cause exception at the given index.
      *
      * @param <T> type of exception to return.
      * @param index index in the cause list.
diff --git a/src/main/java/org/apache/commons/io/IOUtils.java b/src/main/java/org/apache/commons/io/IOUtils.java
index 55885b8..d5593c6 100644
--- a/src/main/java/org/apache/commons/io/IOUtils.java
+++ b/src/main/java/org/apache/commons/io/IOUtils.java
@@ -178,6 +178,7 @@ public class IOUtils {
      * @throws NullPointerException if the input parameter is null
      * @since 2.5
      */
+    @SuppressWarnings("resource") // parameter null check
     public static BufferedInputStream buffer(final InputStream inputStream) {
         // reject null early on rather than waiting for IO operation to fail
         // not checked by BufferedInputStream
@@ -196,6 +197,7 @@ public class IOUtils {
      * @throws NullPointerException if the input parameter is null
      * @since 2.5
      */
+    @SuppressWarnings("resource") // parameter null check
     public static BufferedInputStream buffer(final InputStream inputStream, final int size) {
         // reject null early on rather than waiting for IO operation to fail
         // not checked by BufferedInputStream
@@ -213,6 +215,7 @@ public class IOUtils {
      * @throws NullPointerException if the input parameter is null
      * @since 2.5
      */
+    @SuppressWarnings("resource") // parameter null check
     public static BufferedOutputStream buffer(final OutputStream outputStream) {
         // reject null early on rather than waiting for IO operation to fail
         // not checked by BufferedInputStream
@@ -231,6 +234,7 @@ public class IOUtils {
      * @throws NullPointerException if the input parameter is null
      * @since 2.5
      */
+    @SuppressWarnings("resource") // parameter null check
     public static BufferedOutputStream buffer(final OutputStream outputStream, final int size) {
         // reject null early on rather than waiting for IO operation to fail
         // not checked by BufferedInputStream
diff --git a/src/main/java/org/apache/commons/io/input/DemuxInputStream.java b/src/main/java/org/apache/commons/io/input/DemuxInputStream.java
index 775478e..f3bf092 100644
--- a/src/main/java/org/apache/commons/io/input/DemuxInputStream.java
+++ b/src/main/java/org/apache/commons/io/input/DemuxInputStream.java
@@ -30,7 +30,7 @@ public class DemuxInputStream extends InputStream {
     private final InheritableThreadLocal<InputStream> inputStream = new InheritableThreadLocal<>();
 
     /**
-     * Bind the specified stream to the current thread.
+     * Binds the specified stream to the current thread.
      *
      * @param input the stream to bind
      * @return the InputStream that was previously active
@@ -52,7 +52,7 @@ public class DemuxInputStream extends InputStream {
     }
 
     /**
-     * Read byte from stream associated with current thread.
+     * Reads byte from stream associated with current thread.
      *
      * @return the byte read from stream
      * @throws IOException if an error occurs
diff --git a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
index 64ce89b..f4144a8 100644
--- a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
+++ b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
@@ -277,7 +277,7 @@ public class XmlStreamReader extends Reader {
         final BOMInputStream bom = new BOMInputStream(new BufferedInputStream(inputStream, BUFFER_SIZE), false, BOMS);
         final BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
         if (conn instanceof HttpURLConnection || contentType != null) {
-            this.encoding = doHttpStream(bom, pis, contentType, lenient);
+            this.encoding = processHttpStream(bom, pis, contentType, lenient);
         } else {
             this.encoding = doRawStream(bom, pis, lenient);
         }
@@ -346,7 +346,7 @@ public class XmlStreamReader extends Reader {
         this.defaultEncoding = defaultEncoding;
         final BOMInputStream bom = new BOMInputStream(new BufferedInputStream(inputStream, BUFFER_SIZE), false, BOMS);
         final BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
-        this.encoding = doHttpStream(bom, pis, httpContentType, lenient);
+        this.encoding = processHttpStream(bom, pis, httpContentType, lenient);
         this.reader = new InputStreamReader(pis, encoding);
     }
 
@@ -456,14 +456,13 @@ public class XmlStreamReader extends Reader {
      * @return the encoding to be used
      * @throws IOException thrown if there is a problem reading the stream.
      */
-    private String doHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
-            final boolean lenient) throws IOException {
-        final String bomEnc      = bom.getBOMCharsetName();
+    private String processHttpStream(final BOMInputStream bom, final BOMInputStream pis, final String httpContentType,
+        final boolean lenient) throws IOException {
+        final String bomEnc = bom.getBOMCharsetName();
         final String xmlGuessEnc = pis.getBOMCharsetName();
         final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
         try {
-            return calculateHttpEncoding(httpContentType, bomEnc,
-                    xmlGuessEnc, xmlEnc, lenient);
+            return calculateHttpEncoding(httpContentType, bomEnc, xmlGuessEnc, xmlEnc, lenient);
         } catch (final XmlStreamReaderException ex) {
             if (lenient) {
                 return doLenientDetection(httpContentType, ex);


[commons-io] 02/03: Javadoc.

Posted by gg...@apache.org.
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

commit ec961e516394a82c4e67fec57be933108e239848
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Sep 3 08:16:37 2020 -0400

    Javadoc.
---
 src/main/java/org/apache/commons/io/input/XmlStreamReader.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
index 495b315..64ce89b 100644
--- a/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
+++ b/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
@@ -696,6 +696,9 @@ public class XmlStreamReader extends Reader {
         return encoding;
     }
 
+    /**
+     * Pattern capturing the encoding of the "xml" processing instruction.
+     */
     public static final Pattern ENCODING_PATTERN = Pattern.compile(
             "<\\?xml.*encoding[\\s]*=[\\s]*((?:\".[^\"]*\")|(?:'.[^']*'))",
             Pattern.MULTILINE);