From 1209d2fb8833bcf165bccc963f26897d2562c530 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 15 Feb 2012 11:51:06 +0000 Subject: [PATCH] Fix bug #52665 - When reading from a ZipFileZipEntrySource that has already been closed, give IllegalArgumentException rather than NPE git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1244450 13f79535-47bb-0310-9956-ffa450edef68 --- src/documentation/content/xdocs/status.xml | 1 + .../apache/poi/openxml4j/util/ZipFileZipEntrySource.java | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index 665a6cb18b..31402b1482 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 52665 - When reading from a ZipFileZipEntrySource that has already been closed, give IllegalArgumentException rather than NPE 52664 - MAPIMessage may not always have name chunks when checking for 7 bit encodings 52649 - fixed namespace issue in WordToFoConverter 52385 - avoid trancated array and vector data when reading OLE properties diff --git a/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java b/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java index 5c2b7b35e4..f4117f44bf 100644 --- a/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java +++ b/src/ooxml/java/org/apache/poi/openxml4j/util/ZipFileZipEntrySource.java @@ -41,10 +41,16 @@ public class ZipFileZipEntrySource implements ZipEntrySource { } public Enumeration getEntries() { + if (zipArchive == null) + throw new IllegalStateException("Zip File is closed"); + return zipArchive.entries(); } public InputStream getInputStream(ZipEntry entry) throws IOException { + if (zipArchive == null) + throw new IllegalStateException("Zip File is closed"); + return zipArchive.getInputStream(entry); } } -- 2.39.5