poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1765875 - in /poi/trunk/src: ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java
Date Thu, 20 Oct 2016 20:31:50 GMT
Author: centic
Date: Thu Oct 20 20:31:50 2016
New Revision: 1765875

URL: http://svn.apache.org/viewvc?rev=1765875&view=rev
Log:
Add some missing close() calls

Modified:
    poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
    poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
    poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java?rev=1765875&r1=1765874&r2=1765875&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/extractor/TestExtractorFactory.java Thu Oct
20 20:31:50 2016
@@ -684,11 +684,11 @@ public class TestExtractorFactory {
         // Text
         try {
             ExtractorFactory.createExtractor(OPCPackage.open(txt.toString()));
-            fail("TestExtractorFactory.testPackage() failed on " + txt.toString());
+            fail("TestExtractorFactory.testPackage() failed on " + txt);
         } catch(UnsupportedFileFormatException e) {
             // Good
         } catch (Exception e) {
-            System.out.println("TestExtractorFactory.testPackage() failed on " + txt.toString());
+            System.out.println("TestExtractorFactory.testPackage() failed on " + txt);
             throw e;
         }
     }
@@ -1028,9 +1028,12 @@ public class TestExtractorFactory {
     @Test(expected=AssertionError.class)
     public void test45565() throws Exception {
         POITextExtractor extractor = ExtractorFactory.createExtractor(HSSFTestDataSamples.getSampleFile("45565.xls"));
-        String text = extractor.getText();
-        assertContains(text, "testdoc");
-        assertContains(text, "test phrase");
-        extractor.close();
+        try {
+            String text = extractor.getText();
+            assertContains(text, "testdoc");
+            assertContains(text, "test phrase");
+        } finally {
+            extractor.close();
+        }
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java?rev=1765875&r1=1765874&r2=1765875&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java Thu Oct
20 20:31:50 2016
@@ -366,5 +366,6 @@ public final class TestOldExcelExtractor
         } catch (EncryptedDocumentException e) {
             assertTrue("correct exception thrown", true);
         }
+        ex.close();
     }
 }

Modified: poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java?rev=1765875&r1=1765874&r2=1765875&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/poifs/macros/TestVBAMacroReader.java Thu Oct 20
20:31:50 2016
@@ -17,11 +17,12 @@
 
 package org.apache.poi.poifs.macros;
 
-import static org.apache.poi.POITestCase.assertContains;
-import static org.apache.poi.POITestCase.skipTest;
-import static org.apache.poi.POITestCase.testPassesNow;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
+import org.apache.poi.POIDataSamples;
+import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
+import org.apache.poi.util.IOUtils;
+import org.apache.poi.util.StringUtil;
+import org.junit.Ignore;
+import org.junit.Test;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -31,12 +32,9 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.poi.POIDataSamples;
-import org.apache.poi.poifs.filesystem.NPOIFSFileSystem;
-import org.apache.poi.util.IOUtils;
-import org.apache.poi.util.StringUtil;
-import org.junit.Ignore;
-import org.junit.Test;
+import static org.apache.poi.POITestCase.assertContains;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 
 public class TestVBAMacroReader {
     private static final Map<POIDataSamples, String> expectedMacroContents;
@@ -255,6 +253,7 @@ public class TestVBAMacroReader {
         Map<String, String> macros = r.readMacros();
         assertNotNull(macros.get("Module20"));
         assertContains(macros.get("Module20"), "here start of superscripting");
+        r.close();
     }
 
     @Test
@@ -264,6 +263,7 @@ public class TestVBAMacroReader {
         Map<String, String> macros = r.readMacros();
         assertNotNull(macros.get("Sheet4"));
         assertContains(macros.get("Sheet4"), "intentional constituent");
+        r.close();
     }
 
     @Test
@@ -273,6 +273,7 @@ public class TestVBAMacroReader {
         Map<String, String> macros = r.readMacros();
         assertNotNull(macros.get("NewMacros"));
         assertContains(macros.get("NewMacros"), "' dirty");
+        r.close();
     }
 
     @Test
@@ -283,5 +284,6 @@ public class TestVBAMacroReader {
         Map<String, String> macros = r.readMacros();
         assertNotNull(macros.get("Module1"));
         assertContains(macros.get("Module1"), "9/8/2004");
+        r.close();
     }
 }



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


Mime
View raw message