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/29 03:41:47 UTC

[commons-io] branch master updated: Supress warning, rename params.

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 b47d312  Supress warning, rename params.
b47d312 is described below

commit b47d312ad8689841983e0548569b28dc40d31157
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jan 28 22:41:42 2021 -0500

    Supress warning, rename params.
---
 .../io/input/compatibility/XmlStreamReader.java    | 43 +++++++++++-----------
 .../compatibility/XmlStreamReaderException.java    | 10 ++---
 2 files changed, 27 insertions(+), 26 deletions(-)

diff --git a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
index ed3d0ca..df8ed51 100644
--- a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
+++ b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReader.java
@@ -129,6 +129,7 @@ public class XmlStreamReader extends Reader {
      * @param file File to create a Reader from.
      * @throws IOException thrown if there is a problem reading the file.
      */
+    @SuppressWarnings("resource") // FileInputStream is closed when this closed when this object is closed.
     public XmlStreamReader(final File file) throws IOException {
         this(new FileInputStream(file));
     }
@@ -141,11 +142,11 @@ public class XmlStreamReader extends Reader {
      * It does a lenient charset encoding detection, check the constructor with
      * the lenient parameter for details.
      *
-     * @param is InputStream to create a Reader from.
+     * @param inputStream InputStream to create a Reader from.
      * @throws IOException thrown if there is a problem reading the stream.
      */
-    public XmlStreamReader(final InputStream is) throws IOException {
-        this(is, true);
+    public XmlStreamReader(final InputStream inputStream) throws IOException {
+        this(inputStream, true);
     }
 
     /**
@@ -168,18 +169,18 @@ public class XmlStreamReader extends Reader {
      * If lenient detection is indicated an XmlStreamReaderException is never
      * thrown.
      *
-     * @param is InputStream to create a Reader from.
+     * @param inputStream InputStream to create a Reader from.
      * @param lenient indicates if the charset encoding detection should be
      *        relaxed.
      * @throws IOException thrown if there is a problem reading the stream.
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(final InputStream is, final boolean lenient) throws IOException,
+    public XmlStreamReader(final InputStream inputStream, final boolean lenient) throws IOException,
             XmlStreamReaderException {
         defaultEncoding = staticDefaultEncoding;
         try {
-            doRawStream(is);
+            doRawStream(inputStream);
         } catch (final XmlStreamReaderException ex) {
             if (!lenient) {
                 throw ex;
@@ -265,14 +266,14 @@ public class XmlStreamReader extends Reader {
      * It does a lenient charset encoding detection, check the constructor with
      * the lenient parameter for details.
      *
-     * @param is InputStream to create the reader from.
+     * @param inputStream InputStream to create the reader from.
      * @param httpContentType content-type header to use for the resolution of
      *        the charset encoding.
      * @throws IOException thrown if there is a problem reading the file.
      */
-    public XmlStreamReader(final InputStream is, final String httpContentType)
+    public XmlStreamReader(final InputStream inputStream, final String httpContentType)
             throws IOException {
-        this(is, httpContentType, true);
+        this(inputStream, httpContentType, true);
     }
 
     /**
@@ -299,7 +300,7 @@ public class XmlStreamReader extends Reader {
      * If lenient detection is indicated an XmlStreamReaderException is never
      * thrown.
      *
-     * @param is InputStream to create the reader from.
+     * @param inputStream InputStream to create the reader from.
      * @param httpContentType content-type header to use for the resolution of
      *        the charset encoding.
      * @param lenient indicates if the charset encoding detection should be
@@ -309,13 +310,13 @@ public class XmlStreamReader extends Reader {
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(final InputStream is, final String httpContentType,
+    public XmlStreamReader(final InputStream inputStream, final String httpContentType,
             final boolean lenient, final String defaultEncoding) throws IOException,
             XmlStreamReaderException {
         this.defaultEncoding = defaultEncoding == null ? staticDefaultEncoding
                 : defaultEncoding;
         try {
-            doHttpStream(is, httpContentType, lenient);
+            doHttpStream(inputStream, httpContentType, lenient);
         } catch (final XmlStreamReaderException ex) {
             if (!lenient) {
                 throw ex;
@@ -348,7 +349,7 @@ public class XmlStreamReader extends Reader {
      * If lenient detection is indicated an XmlStreamReaderException is never
      * thrown.
      *
-     * @param is InputStream to create the reader from.
+     * @param inputStream InputStream to create the reader from.
      * @param httpContentType content-type header to use for the resolution of
      *        the charset encoding.
      * @param lenient indicates if the charset encoding detection should be
@@ -357,9 +358,9 @@ public class XmlStreamReader extends Reader {
      * @throws XmlStreamReaderException thrown if the charset encoding could not
      *         be determined according to the specs.
      */
-    public XmlStreamReader(final InputStream is, final String httpContentType,
+    public XmlStreamReader(final InputStream inputStream, final String httpContentType,
             final boolean lenient) throws IOException, XmlStreamReaderException {
-        this(is, httpContentType, lenient, null);
+        this(inputStream, httpContentType, lenient, null);
     }
 
     private void doLenientDetection(String httpContentType,
@@ -413,9 +414,9 @@ public class XmlStreamReader extends Reader {
         reader.close();
     }
 
-    private void doRawStream(final InputStream is)
+    private void doRawStream(final InputStream inputStream)
             throws IOException {
-        final BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
+        final BufferedInputStream pis = new BufferedInputStream(inputStream, BUFFER_SIZE);
         final String bomEnc = getBOMEncoding(pis);
         final String xmlGuessEnc = getXMLGuessEncoding(pis);
         final String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
@@ -423,9 +424,9 @@ public class XmlStreamReader extends Reader {
         prepareReader(pis, encoding);
     }
 
-    private void doHttpStream(final InputStream is, final String httpContentType,
+    private void doHttpStream(final InputStream inputStream, final String httpContentType,
             final boolean lenient) throws IOException {
-        final BufferedInputStream pis = new BufferedInputStream(is, BUFFER_SIZE);
+        final BufferedInputStream pis = new BufferedInputStream(inputStream, BUFFER_SIZE);
         final String cTMime = getContentTypeMime(httpContentType);
         final String cTEnc = getContentTypeEncoding(httpContentType);
         final String bomEnc = getBOMEncoding(pis);
@@ -436,9 +437,9 @@ public class XmlStreamReader extends Reader {
         prepareReader(pis, encoding);
     }
 
-    private void prepareReader(final InputStream is, final String encoding)
+    private void prepareReader(final InputStream inputStream, final String encoding)
             throws IOException {
-        reader = new InputStreamReader(is, encoding);
+        reader = new InputStreamReader(inputStream, encoding);
         this.encoding = encoding;
     }
 
diff --git a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java
index 91fd719..cb4931f 100644
--- a/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java
+++ b/src/test/java/org/apache/commons/io/input/compatibility/XmlStreamReaderException.java
@@ -33,7 +33,7 @@ public class XmlStreamReaderException extends org.apache.commons.io.input.XmlStr
 
     private static final long serialVersionUID = 1L;
 
-    private final InputStream is;
+    private final InputStream inputStream;
 
     /**
      * Creates an exception instance if the charset encoding could not be
@@ -64,12 +64,12 @@ public class XmlStreamReaderException extends org.apache.commons.io.input.XmlStr
      * @param bomEnc BOM encoding.
      * @param xmlGuessEnc XML guess encoding.
      * @param xmlEnc XML prolog encoding.
-     * @param is the unconsumed InputStream.
+     * @param inputStream the unconsumed InputStream.
      */
     public XmlStreamReaderException(final String msg, final String ctMime, final String ctEnc,
-            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final InputStream is) {
+            final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final InputStream inputStream) {
         super(msg, ctMime, ctEnc, bomEnc, xmlGuessEnc, xmlEnc);
-        this.is = is;
+        this.inputStream = inputStream;
     }
 
     /**
@@ -79,6 +79,6 @@ public class XmlStreamReaderException extends org.apache.commons.io.input.XmlStr
      * @return the unconsumed InputStream.
      */
     public InputStream getInputStream() {
-        return is;
+        return inputStream;
     }
 }