Browse Source

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
tags/REL_5_1_0
Andreas Beeker 2 years ago
parent
commit
c270cf95fd

+ 3
- 3
poi/src/main/java/org/apache/poi/hssf/extractor/OldExcelExtractor.java View File

System.err.println(" OldExcelExtractor <filename>"); System.err.println(" OldExcelExtractor <filename>");
System.exit(1); 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() { private void prepare() {

+ 3
- 0
poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java View File

import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.LocaleUtil; import org.apache.poi.util.LocaleUtil;
import org.apache.poi.util.RecordFormatException; import org.apache.poi.util.RecordFormatException;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;


/** /**
} }


@Test @Test
@Disabled("Redirecting System.out/err is bad in concurrent test environment")
void testMainUsage() { void testMainUsage() {
PrintStream save = System.err; PrintStream save = System.err;
SecurityManager sm = System.getSecurityManager(); SecurityManager sm = System.getSecurityManager();
} }


@Test @Test
@Disabled("Redirecting System.out/err is bad in concurrent test environment")
void testMain() throws IOException { void testMain() throws IOException {
File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls"); File file = HSSFTestDataSamples.getSampleFile("testEXCEL_3.xls");
PrintStream save = System.out; PrintStream save = System.out;

Loading…
Cancel
Save