Author: niallp
Date: Tue Oct  5 02:58:36 2010
New Revision: 1004514

URL: http://svn.apache.org/viewvc?rev=1004514&view=rev
Log:
Refactoring - move mine/encoding content type detection into the 
calculateHttpEncoding() method where its used

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=1004514&r1=1004513&r2=1004514&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:58:36 2010
@@ -465,12 +465,10 @@ public class XmlStreamReader extends Rea
             boolean lenient) throws IOException {
         BOMInputStream bom = new BOMInputStream(new BufferedInputStream(is, 
BUFFER_SIZE), false, BOMS);
         BOMInputStream pis = new BOMInputStream(bom, true, XML_GUESS_BYTES);
-        String cTMime = getContentTypeMime(httpContentType);
-        String cTEnc = getContentTypeEncoding(httpContentType);
         String bomEnc      = bom.getBOMCharsetName();
         String xmlGuessEnc = pis.getBOMCharsetName();
         String xmlEnc = getXmlProlog(pis, xmlGuessEnc);
-        this.encoding = calculateHttpEncoding(cTMime, cTEnc, bomEnc,
+        this.encoding = calculateHttpEncoding(httpContentType, bomEnc,
                 xmlGuessEnc, xmlEnc, lenient);
         this.reader = new InputStreamReader(is, encoding);
     }
@@ -529,8 +527,7 @@ public class XmlStreamReader extends Rea
     /**
      * Calculate the HTTP encoding.
      *
-     * @param cTMime Mime Content Type
-     * @param cTEnc the content type encoding
+     * @param httpContentType The HTTP content type
      * @param bomEnc BOM encoding
      * @param xmlGuessEnc XML Guess encoding
      * @param xmlEnc XML encoding
@@ -539,9 +536,11 @@ public class XmlStreamReader extends Rea
      * @return the HTTP encoding
      * @throws IOException thrown if there is a problem reading the stream.
      */
-    private String calculateHttpEncoding(String cTMime, String cTEnc,
+    private String calculateHttpEncoding(String httpContentType,
             String bomEnc, String xmlGuessEnc, String xmlEnc,
             boolean lenient) throws IOException {
+        String cTMime = getContentTypeMime(httpContentType);
+        String cTEnc  = getContentTypeEncoding(httpContentType);
         String encoding;
         if (lenient & xmlEnc != null) {
             encoding = xmlEnc;


Reply via email to