Author: niallp
Date: Wed Oct 6 04:16:28 2010
New Revision: 1004891
URL: http://svn.apache.org/viewvc?rev=1004891&view=rev
Log:
Minor re-organization
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=1004891&r1=1004890&r2=1004891&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
Wed Oct 6 04:16:28 2010
@@ -360,38 +360,6 @@ public class XmlStreamReader extends Rea
}
/**
- * Do lenient detection.
- *
- * @param httpContentType content-type header to use for the resolution of
- * the charset encoding.
- * @param is the unconsumed InputStream
- * @param ex The thrown exception
- * @return the encoding
- * @throws IOException thrown if there is a problem reading the stream.
- */
- private String doLenientDetection(String httpContentType, InputStream is,
- XmlStreamReaderException ex) throws IOException {
- if (httpContentType != null &&
httpContentType.startsWith("text/html")) {
- httpContentType = httpContentType.substring("text/html".length());
- httpContentType = "text/xml" + httpContentType;
- try {
- return calculateHttpEncoding(httpContentType,
ex.getBomEncoding(),
- ex.getXmlGuessEncoding(), ex.getXmlEncoding(), true);
- } catch (XmlStreamReaderException ex2) {
- ex = ex2;
- }
- }
- String encoding = ex.getXmlEncoding();
- if (encoding == null) {
- encoding = ex.getContentTypeEncoding();
- }
- if (encoding == null) {
- encoding = (defaultEncoding == null) ? UTF_8 : defaultEncoding;
- }
- return encoding;
- }
-
- /**
* Returns the charset encoding of the XmlStreamReader.
*
* @return charset encoding.
@@ -480,6 +448,38 @@ public class XmlStreamReader extends Rea
}
/**
+ * Do lenient detection.
+ *
+ * @param httpContentType content-type header to use for the resolution of
+ * the charset encoding.
+ * @param is the unconsumed InputStream
+ * @param ex The thrown exception
+ * @return the encoding
+ * @throws IOException thrown if there is a problem reading the stream.
+ */
+ private String doLenientDetection(String httpContentType, InputStream is,
+ XmlStreamReaderException ex) throws IOException {
+ if (httpContentType != null &&
httpContentType.startsWith("text/html")) {
+ httpContentType = httpContentType.substring("text/html".length());
+ httpContentType = "text/xml" + httpContentType;
+ try {
+ return calculateHttpEncoding(httpContentType,
ex.getBomEncoding(),
+ ex.getXmlGuessEncoding(), ex.getXmlEncoding(), true);
+ } catch (XmlStreamReaderException ex2) {
+ ex = ex2;
+ }
+ }
+ String encoding = ex.getXmlEncoding();
+ if (encoding == null) {
+ encoding = ex.getContentTypeEncoding();
+ }
+ if (encoding == null) {
+ encoding = (defaultEncoding == null) ? UTF_8 : defaultEncoding;
+ }
+ return encoding;
+ }
+
+ /**
* Calculate the raw encoding.
*
* @param bomEnc BOM encoding