]> source.dussan.org Git - poi.git/commitdiff
return better error message when ZipEntry has no data (it was closed before the data...
authorPJ Fanning <fanningpj@apache.org>
Mon, 8 Nov 2021 11:15:26 +0000 (11:15 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 8 Nov 2021 11:15:26 +0000 (11:15 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894831 13f79535-47bb-0310-9956-ffa450edef68

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

index 3ed62973d291f31419001f70be6e4144f35636e0..2a32f8b5a772324e15a661f60b7e4a28d2554ff5 100644 (file)
@@ -88,8 +88,10 @@ import org.apache.poi.util.TempFile;
             } catch (FileNotFoundException e) {
                 throw new RuntimeException("temp file " + tempFile.getAbsolutePath() + " is missing");
             }
-        } else {
+        } else if (data != null) {
             return new UnsynchronizedByteArrayInputStream(data);
+        } else {
+            throw new RuntimeException("Cannot retrieve data from Zip Entry, probably because the Zip Entry was closed before the data was requested.");
         }
     }