You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/10/06 00:00:59 UTC
svn commit: r1004825 - in /commons/proper/io/trunk/src:
main/java/org/apache/commons/io/input/XmlStreamReader.java
test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java
Author: niallp
Date: Tue Oct 5 22:00:58 2010
New Revision: 1004825
URL: http://svn.apache.org/viewvc?rev=1004825&view=rev
Log:
IO-162 Throw XmlStreamReaderException instead of IOException (looks like this was missed when it was introduced in ROME)
Modified:
commons/proper/io/trunk/src/main/java/org/apache/commons/io/input/XmlStreamReader.java
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.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=1004825&r1=1004824&r2=1004825&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 22:00:58 2010
@@ -514,7 +514,7 @@ public class XmlStreamReader extends Rea
if (bomEnc.equals(UTF_16BE) || bomEnc.equals(UTF_16LE)) {
if (xmlGuessEnc != null && !xmlGuessEnc.equals(bomEnc)) {
String msg = MessageFormat.format(RAW_EX_1, new Object[] { bomEnc, xmlGuessEnc, xmlEnc });
- throw new IOException(msg);
+ throw new XmlStreamReaderException(msg, bomEnc, xmlGuessEnc, xmlEnc);
}
if (xmlEnc != null && !xmlEnc.equals(UTF_16) && !xmlEnc.equals(bomEnc)) {
String msg = MessageFormat.format(RAW_EX_1, new Object[] { bomEnc, xmlGuessEnc, xmlEnc });
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java?rev=1004825&r1=1004824&r2=1004825&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/XmlStreamReaderUtilitiesTest.java Tue Oct 5 22:00:58 2010
@@ -135,24 +135,24 @@ public class XmlStreamReaderUtilitiesTes
// Expected BOM Guess XMLEnc Default
checkRawEncoding(bomEnc, bomEnc, null, null, defaultEnc);
checkRawEncoding(bomEnc, bomEnc, bomEnc, null, defaultEnc);
- //checkRawError(RAWMGS1, bomEnc, otherEnc, null, defaultEnc); throws IOException for UTF-16BE/LE
+ checkRawError(RAWMGS1, bomEnc, otherEnc, null, defaultEnc);
checkRawEncoding(bomEnc, bomEnc, null, bomEnc, defaultEnc);
checkRawError(RAWMGS1, bomEnc, null, otherEnc, defaultEnc);
checkRawEncoding(bomEnc, bomEnc, bomEnc, bomEnc, defaultEnc);
checkRawError(RAWMGS1, bomEnc, bomEnc, otherEnc, defaultEnc);
- //checkRawError(RAWMGS1, bomEnc, otherEnc, bomEnc, defaultEnc); throws IOException for UTF-16BE/LE
+ checkRawError(RAWMGS1, bomEnc, otherEnc, bomEnc, defaultEnc);
}
/** Additional UTF-16 calculateRawEncoding() Test */
public void testCalculateRawEncodingAdditonalkUTF16() throws IOException {
// BOM Guess XML Default
-// checkRawError(RAWMGS1, "UTF-16BE", "UTF-16", null, null); throws IOException
+ checkRawError(RAWMGS1, "UTF-16BE", "UTF-16", null, null);
checkRawEncoding("UTF-16BE", "UTF-16BE", null, "UTF-16", null);
checkRawEncoding("UTF-16BE", "UTF-16BE", "UTF-16BE", "UTF-16", null);
checkRawError(RAWMGS1, "UTF-16BE", null, "UTF-16LE", null);
checkRawError(RAWMGS1, "UTF-16BE", "UTF-16BE", "UTF-16LE", null);
-// checkRawError(RAWMGS1, "UTF-16LE", "UTF-16", null, null); throws IOException
+ checkRawError(RAWMGS1, "UTF-16LE", "UTF-16", null, null);
checkRawEncoding("UTF-16LE", "UTF-16LE", null, "UTF-16", null);
checkRawEncoding("UTF-16LE", "UTF-16LE", "UTF-16LE", "UTF-16", null);
checkRawError(RAWMGS1, "UTF-16LE", null, "UTF-16BE", null);