From 18c5045d5bb2f7a5ef6b3caa5e81a9791fd1ba2e Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sat, 16 Jan 2016 22:23:05 +0000 Subject: [PATCH] fix questionable List.remove(int) in SXSSFITestDataProvider git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725042 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/xssf/SXSSFITestDataProvider.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java b/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java index c6bb03c1e..28b2d959e 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java @@ -24,7 +24,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; -import java.util.List; +import java.util.Collection; import org.apache.poi.POIDataSamples; import org.apache.poi.ss.ITestDataProvider; @@ -43,7 +43,7 @@ public final class SXSSFITestDataProvider implements ITestDataProvider { // an instance of all SXSSFWorkbooks opened by this TestDataProvider, // so that the temporary files created can be disposed up by cleanup() - private final List instances = new ArrayList(); + private final Collection instances = new ArrayList(); private SXSSFITestDataProvider() { // enforce singleton @@ -107,11 +107,10 @@ public final class SXSSFITestDataProvider implements ITestDataProvider { public synchronized boolean cleanup(){ boolean ok = true; - for(int i = 0; i < instances.size(); i++){ - SXSSFWorkbook wb = instances.get(i); + for(final SXSSFWorkbook wb : instances) { ok = ok && wb.dispose(); - instances.remove(i); } + instances.clear(); return ok; } }