From 5a59376389cb13b211aabea588a822b030b79081 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 8 Nov 2021 11:15:26 +0000 Subject: [PATCH] return better error message when ZipEntry has no data (it was closed before the data was retrieved) git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1894831 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java index 3ed62973d2..2a32f8b5a7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipArchiveFakeEntry.java @@ -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."); } } -- 2.39.5