]> source.dussan.org Git - poi.git/commitdiff
Redirecting System.out/err is bad in concurrent test environment
authorAndreas Beeker <kiwiwings@apache.org>
Sun, 22 Aug 2021 17:48:41 +0000 (17:48 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sun, 22 Aug 2021 17:48:41 +0000 (17:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892530 13f79535-47bb-0310-9956-ffa450edef68

poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java

index 867950f39ae4776dabf140a70d396a7cf4607f6a..2c1c384fb6c7edaf777d9efffc1d79379b2840a6 100644 (file)
@@ -169,9 +169,9 @@ public class OldExcelExtractor implements POITextExtractor {
             System.err.println("   OldExcelExtractor <filename>");
             System.exit(1);
         }
-        OldExcelExtractor extractor = new OldExcelExtractor(new File(args[0]));
-        System.out.println(extractor.getText());
-        extractor.close();
+        try (OldExcelExtractor extractor = new OldExcelExtractor(new File(args[0]))) {
+            System.out.println(extractor.getText());
+        }
     }
 
     private void prepare() {
index 38057b8b5d4a7551628ae01838f9350f118ca627..a2bf77ba6416a508d40304e39eb69264927922e0 100644 (file)
@@ -43,6 +43,7 @@ import org.apache.poi.poifs.filesystem.OfficeXmlFileException;
 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
 import org.apache.poi.util.LocaleUtil;
 import org.apache.poi.util.RecordFormatException;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 /**
@@ -305,6 +306,7 @@ final class TestOldExcelExtractor {
     }
 
     @Test
+    @Disabled("Redirecting System.out/err is bad in concurrent test environment")
     void testMainUsage() {
         PrintStream save = System.err;
         SecurityManager sm = System.getSecurityManager();
@@ -320,6 +322,7 @@ final class TestOldExcelExtractor {
     }
 
     @Test
+    @Disabled("Redirecting System.out/err is bad in concurrent test environment")
     void testMain() throws IOException {
         File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
         PrintStream save = System.out;