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 2012/02/22 20:22:57 UTC
svn commit: r1292460 -
/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
Author: ggregory
Date: Wed Feb 22 19:22:57 2012
New Revision: 1292460
URL: http://svn.apache.org/viewvc?rev=1292460&view=rev
Log:
[IO-302] ArrayIndexOutOfBoundsException in BOMInputStream when reading a file without BOM multiple times. Refactor tests to use both BOM and no-BOM test files.
Modified:
commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
Modified: commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java?rev=1292460&r1=1292459&r2=1292460&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java (original)
+++ commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java Wed Feb 22 19:22:57 2012
@@ -362,14 +362,22 @@ public class BOMInputStreamTest extends
}
public void testReadTwiceWithoutBOM() throws Exception {
- InputStream inputStream = this.getClass().getResourceAsStream("/org/apache/commons/io/testfileNoBOM.xml");
- Assert.assertNotNull(inputStream);
- BOMInputStream bomInputStream = new BOMInputStream(inputStream);
- bomInputStream.mark(1000000);
-
- this.readFile(bomInputStream);
- bomInputStream.reset();
- this.readFile(bomInputStream);
+ this.readBOMInputStreamTwice("/org/apache/commons/io/testfileNoBOM.xml");
+ }
+
+ public void testReadTwiceWithBOM() throws Exception {
+ this.readBOMInputStreamTwice("/org/apache/commons/io/testfileBOM.xml");
+ }
+
+ public void readBOMInputStreamTwice(String resource) throws Exception {
+ InputStream inputStream = this.getClass().getResourceAsStream(resource);
+ Assert.assertNotNull(inputStream);
+ BOMInputStream bomInputStream = new BOMInputStream(inputStream);
+ bomInputStream.mark(1000000);
+
+ this.readFile(bomInputStream);
+ bomInputStream.reset();
+ this.readFile(bomInputStream);
}
private void readFile(BOMInputStream bomInputStream) throws Exception {