aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-02-03 19:37:02 +0000
committerPJ Fanning <fanningpj@apache.org>2022-02-03 19:37:02 +0000
commitc905a07fc4482a1b6650d205c5a9d764c9951cdd (patch)
treebf8da642205c53ff7b14f5068c26e215c33b1c73 /poi-ooxml
parent1bdd44fc88f9c3833d69bfdcd455c1d48f5f4a3f (diff)
downloadpoi-c905a07fc4482a1b6650d205c5a9d764c9951cdd.tar.gz
poi-c905a07fc4482a1b6650d205c5a9d764c9951cdd.zip
add regression test for opczip
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1897739 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/OpcZipTest.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/OpcZipTest.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/OpcZipTest.java
index 8c7ecec01c..230a65a3db 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/OpcZipTest.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/OpcZipTest.java
@@ -4,7 +4,9 @@ import org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream;
import org.junit.jupiter.api.Test;
import java.io.PrintStream;
+import java.nio.charset.StandardCharsets;
import java.util.LinkedHashMap;
+import java.util.Locale;
import java.util.Map;
import java.util.zip.ZipEntry;
@@ -21,7 +23,7 @@ class OpcZipTest {
try (OpcOutputStream zip = new OpcOutputStream(bos1)) {
for (Map.Entry<String, String> entry : contents.entrySet()) {
zip.putNextEntry(entry.getKey());
- PrintStream printer = new PrintStream(zip);
+ PrintStream printer = new PrintStream(zip, true, StandardCharsets.UTF_8.name());
printer.print(entry.getValue());
printer.flush();
zip.closeEntry();
@@ -30,7 +32,7 @@ class OpcZipTest {
try (com.github.rzymek.opczip.OpcOutputStream zip = new com.github.rzymek.opczip.OpcOutputStream(bos2)) {
for (Map.Entry<String, String> entry : contents.entrySet()) {
zip.putNextEntry(new ZipEntry(entry.getKey()));
- PrintStream printer = new PrintStream(zip);
+ PrintStream printer = new PrintStream(zip, true, StandardCharsets.UTF_8.name());
printer.print(entry.getValue());
printer.flush();
zip.closeEntry();
@@ -43,7 +45,7 @@ class OpcZipTest {
private static Map<String, String> createContents() {
Map<String, String> contents = new LinkedHashMap<>();
for (int i = 0; i < 3; i++) {
- String name = String.format("dir%s/file%s.txt", i % 3, i);
+ String name = String.format(Locale.US, "dir%s/file%s.txt", i % 3, i);
contents.put(name, "this is the contents");
}
return contents;