poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1725042 - /poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java
Date Sat, 16 Jan 2016 22:23:06 GMT
Author: onealj
Date: Sat Jan 16 22:23:05 2016
New Revision: 1725042

URL: http://svn.apache.org/viewvc?rev=1725042&view=rev
Log:
fix questionable List.remove(int) in SXSSFITestDataProvider

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java?rev=1725042&r1=1725041&r2=1725042&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/SXSSFITestDataProvider.java Sat Jan
16 22:23:05 2016
@@ -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 SXSSFITestDataProvide
 
     // 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 SXSSFITestDataProvide
 
     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;
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message