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
This commit is contained in:
PJ Fanning 2021-11-08 11:15:26 +00:00
parent 336bce7c82
commit 5a59376389
1 changed files with 3 additions and 1 deletions

View 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.");
}
}