Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D46DA9C8B for ; Wed, 22 Feb 2012 19:23:18 +0000 (UTC) Received: (qmail 847 invoked by uid 500); 22 Feb 2012 19:23:18 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 777 invoked by uid 500); 22 Feb 2012 19:23:18 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 770 invoked by uid 99); 22 Feb 2012 19:23:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 19:23:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 19:23:17 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 99E3623889DA for ; Wed, 22 Feb 2012 19:22:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1292460 - /commons/proper/io/trunk/src/test/java/org/apache/commons/io/input/BOMInputStreamTest.java Date: Wed, 22 Feb 2012 19:22:57 -0000 To: commits@commons.apache.org From: ggregory@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120222192257.99E3623889DA@eris.apache.org> 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 {