commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r1004512 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
Date Tue, 05 Oct 2010 02:49:20 GMT
Author: niallp
Date: Tue Oct  5 02:49:20 2010
New Revision: 1004512

URL: http://svn.apache.org/viewvc?rev=1004512&view=rev
Log:
Refactoring to remove the InputStream from XmlStreamReaderException in r1004109 means we don't
need to pass the InputStream to the calculateRawEncoding() and calculateHttpEncoding() methods


Modified:
    commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java

Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java?rev=1004512&r1=1004511&r2=1004512&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
(original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
Tue Oct  5 02:49:20 2010
@@ -448,7 +448,7 @@ public class XmlStreamReader extends Rea
         String bomEnc      = bom.getBOMCharsetName();
         String xmlGuessEnc = pis.getBOMCharsetName();
         String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
-        this.encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, pis);
+        this.encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
         this.reader = new InputStreamReader(is, encoding);
     }
 
@@ -471,7 +471,7 @@ public class XmlStreamReader extends Rea
         String xmlGuessEnc = pis.getBOMCharsetName();
         String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
         this.encoding = calculateHttpEncoding(cTMime, cTEnc, bomEnc,
-                xmlGuessEnc, xmlEnc, pis, lenient);
+                xmlGuessEnc, xmlEnc, lenient);
         this.reader = new InputStreamReader(is, encoding);
     }
 
@@ -481,12 +481,11 @@ public class XmlStreamReader extends Rea
      * @param bomEnc BOM encoding
      * @param xmlGuessEnc XML Guess encoding
      * @param xmlEnc XML encoding
-     * @param is InputStream to create the reader from.
      * @return the raw encoding
      * @throws IOException thrown if there is a problem reading the stream.
      */
     private String calculateRawEncoding(String bomEnc, String xmlGuessEnc,
-            String xmlEnc, InputStream is) throws IOException {
+            String xmlEnc) throws IOException {
         String encoding;
         if (bomEnc == null) {
             if (xmlGuessEnc == null || xmlEnc == null) {
@@ -535,14 +534,13 @@ public class XmlStreamReader extends Rea
      * @param bomEnc BOM encoding
      * @param xmlGuessEnc XML Guess encoding
      * @param xmlEnc XML encoding
-     * @param is InputStream to create the reader from.
      * @param lenient indicates if the charset encoding detection should be
      *        relaxed.
      * @return the HTTP encoding
      * @throws IOException thrown if there is a problem reading the stream.
      */
     private String calculateHttpEncoding(String cTMime, String cTEnc,
-            String bomEnc, String xmlGuessEnc, String xmlEnc, InputStream is,
+            String bomEnc, String xmlGuessEnc, String xmlEnc,
             boolean lenient) throws IOException {
         String encoding;
         if (lenient & xmlEnc != null) {
@@ -553,8 +551,7 @@ public class XmlStreamReader extends Rea
             if (appXml || textXml) {
                 if (cTEnc == null) {
                     if (appXml) {
-                        encoding = calculateRawEncoding(bomEnc, xmlGuessEnc,
-                                xmlEnc, is);
+                        encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc);
                     } else {
                         encoding = (defaultEncoding == null) ? US_ASCII
                                 : defaultEncoding;



Mime
View raw message