aboutsummaryrefslogtreecommitdiffstats
path: root/poi-ooxml
diff options
context:
space:
mode:
Diffstat (limited to 'poi-ooxml')
-rw-r--r--poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java
index 0546e7cd11..36c30a7428 100644
--- a/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java
+++ b/poi-ooxml/src/test/java/org/apache/poi/xwpf/usermodel/TestXWPFDocument.java
@@ -35,6 +35,7 @@ import java.util.Optional;
import org.apache.poi.POIDataSamples;
import org.apache.poi.common.usermodel.PictureType;
import org.apache.poi.ooxml.POIXMLDocumentPart;
+import org.apache.poi.ooxml.POIXMLException;
import org.apache.poi.ooxml.POIXMLProperties;
import org.apache.poi.ooxml.TrackingInputStream;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
@@ -505,6 +506,18 @@ public final class TestXWPFDocument {
}
@Test
+ void testUnicodePathDocWithCorruptZipEntry() {
+ // this is a file that we do not want to be able to parse, as it contains a corrupt zip entry
+ POIXMLException ex = assertThrows(POIXMLException.class, () -> {
+ try (XWPFDocument doc = new XWPFDocument(
+ POIDataSamples.getDocumentInstance().openResourceAsStream("unicode-path.docx"))) {
+ // expect exception here
+ }
+ });
+ assertEquals("InvalidFormatException", ex.getCause().getClass().getSimpleName());
+ }
+
+ @Test
@Disabled("XWPF should be able to write to a new Stream when opened Read-Only")
void testWriteFromReadOnlyOPC() throws Exception {
try (OPCPackage opc = OPCPackage.open(