diff options
author | PJ Fanning <fanningpj@apache.org> | 2022-07-15 21:52:32 +0000 |
---|---|---|
committer | PJ Fanning <fanningpj@apache.org> | 2022-07-15 21:52:32 +0000 |
commit | 87ee700d04af1fea764c0762f0fb5dada4411295 (patch) | |
tree | fadbb626410244764c087b4ed23cc467eed76764 /poi-examples/src/test | |
parent | 70bd85fda41f885427e3db8d5b32eb71656f8eb0 (diff) | |
download | poi-87ee700d04af1fea764c0762f0fb5dada4411295.tar.gz poi-87ee700d04af1fea764c0762f0fb5dada4411295.zip |
[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
Diffstat (limited to 'poi-examples/src/test')
-rw-r--r-- | poi-examples/src/test/java/org/apache/poi/integration/TestXLSX2CSV.java | 8 |
1 files changed, 4 insertions, 4 deletions
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)) { |