From 87ee700d04af1fea764c0762f0fb5dada4411295 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Fri, 15 Jul 2022 21:52:32 +0000 Subject: [github-340] make more use of StandardCharsets. Thanks to XenoAmess. This closes #340 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1902755 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/org/apache/poi/integration/TestXLSX2CSV.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'poi-examples/src/test') diff --git a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java index 4d1a95444d..a9bed39008 100644 --- a/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java +++ b/poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java @@ -42,7 +42,7 @@ public class TestXLSX2CSV { // remember and replace default error streams err = System.err; - PrintStream error = new PrintStream(errorBytes, true, "UTF-8"); + PrintStream error = new PrintStream(errorBytes, true, StandardCharsets.UTF_8.name()); System.setErr(error); } @@ -71,14 +71,14 @@ public class TestXLSX2CSV { // returns with some System.err XLSX2CSV.main(new String[] { "not-existing-file.xlsx" }); - String output = errorBytes.toString("UTF-8"); + String output = errorBytes.toString(StandardCharsets.UTF_8); assertTrue(output.contains("Not found or not a file: not-existing-file.xlsx"), "Had: " + output); } @Test public void testSampleFile() throws Exception { final UnsynchronizedByteArrayOutputStream outputBytes = new UnsynchronizedByteArrayOutputStream(); - PrintStream out = new PrintStream(outputBytes, true, "UTF-8"); + PrintStream out = new PrintStream(outputBytes, true, StandardCharsets.UTF_8.name()); // The package open is instantaneous, as it should be. try (OPCPackage p = OPCPackage.open(XSSFTestDataSamples.getSampleFile("sample.xlsx").getAbsolutePath(), PackageAccess.READ)) { @@ -97,7 +97,7 @@ public class TestXLSX2CSV { @Test public void testMinColumns() throws Exception { final UnsynchronizedByteArrayOutputStream outputBytes = new UnsynchronizedByteArrayOutputStream(); - PrintStream out = new PrintStream(outputBytes, true, "UTF-8"); + PrintStream out = new PrintStream(outputBytes, true, StandardCharsets.UTF_8.name()); // The package open is instantaneous, as it should be. try (OPCPackage p = OPCPackage.open(XSSFTestDataSamples.getSampleFile("sample.xlsx").getAbsolutePath(), PackageAccess.READ)) { -- cgit v1.2.3