aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2021-08-22 17:48:41 +0000
committerAndreas Beeker <kiwiwings@apache.org>2021-08-22 17:48:41 +0000
commitc270cf95fdc92741dc6be891fe762891435fa6de (patch)
tree5d5c7bc3608ff21b1b6287e2825b898f666ca519 /poi
parent41f2ab056f7215407d414f2e1a272e4e304de051 (diff)
downloadpoi-c270cf95fdc92741dc6be891fe762891435fa6de.tar.gz
poi-c270cf95fdc92741dc6be891fe762891435fa6de.zip
Redirecting System.out/err is bad in concurrent test environment
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1892530 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java6
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java3
2 files changed, 6 insertions, 3 deletions
diff --git a/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java b/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
index 867950f39a..2c1c384fb6 100644
--- a/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
+++ b/poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java
@@ -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() {
diff --git a/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
index 38057b8b5d..a2bf77ba64 100644
--- a/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
+++ b/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
@@ -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;