]> source.dussan.org Git - poi.git/commitdiff
try to fix issue with invalid files after commons-compress upgrade
authorPJ Fanning <fanningpj@apache.org>
Tue, 20 Feb 2024 16:31:04 +0000 (16:31 +0000)
committerPJ Fanning <fanningpj@apache.org>
Tue, 20 Feb 2024 16:31:04 +0000 (16:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915895 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveThresholdInputStream.java

index 75e896e78b76acb96583c4bb1da4788cf1d4e734..6c65589ddc8b0128ff9b98ac3429bdd3dc15dcb8 100644 (file)
@@ -155,7 +155,9 @@ public class ZipArchiveThresholdInputStream extends FilterInputStream {
             }
             return entry;
         } catch (ZipException ze) {
-            if (ze.getMessage().startsWith("Unexpected record signature")) {
+            final String msg = ze.getMessage();
+            if (msg.startsWith("Unexpected record signature")
+                    || msg.startsWith("Cannot find zip signature within the file")) {
                 throw new NotOfficeXmlFileException(
                         "No valid entries or contents found, this is not a valid OOXML (Office Open XML) file", ze);
             }