summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaven O'Neal <onealj@apache.org>2016-01-16 22:23:05 +0000
committerJaven O'Neal <onealj@apache.org>2016-01-16 22:23:05 +0000
commitf0da444c326795b9581be6408e36b852e589ab0b (patch)
tree85685c3464adb8a7103a17521863053f86b28cbf
parent118f7f283b1b608061d048b5a6044d7de417c37c (diff)
downloadpoi-f0da444c326795b9581be6408e36b852e589ab0b.tar.gz
poi-f0da444c326795b9581be6408e36b852e589ab0b.zip
fix questionable List.remove(int) in SXSSFITestDataProvider
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1725042 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java9
1 files 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 c6bb03c1ec..28b2d959e7 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<SXSSFWorkbook> instances = new ArrayList<SXSSFWorkbook>();
+ private final Collection<SXSSFWorkbook> instances = new ArrayList<SXSSFWorkbook>();
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;
}
}