Fix bug #51949 - Avoid NPE on double close of ZipFileZipEntrySource

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1179452 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2011-10-05 21:29:32 +00:00
parent 31924dff8b
commit 4b61edfdb3
2 changed files with 20 additions and 17 deletions

View File

@ -34,6 +34,7 @@
<changes> <changes>
<release version="3.8-beta5" date="2011-??-??"> <release version="3.8-beta5" date="2011-??-??">
<action dev="poi-developers" type="fix">51949 - Avoid NPE on double close of ZipFileZipEntrySource</action>
<action dev="poi-developers" type="fix">51950 - XWPF fix for footnotes not always being present in a document</action> <action dev="poi-developers" type="fix">51950 - XWPF fix for footnotes not always being present in a document</action>
<action dev="poi-developers" type="fix">51963 - Correct AreaReference handling of references containing a sheet name which includes a comma</action> <action dev="poi-developers" type="fix">51963 - Correct AreaReference handling of references containing a sheet name which includes a comma</action>
<action dev="poi-developers" type="fix">51955 - XSSFReader supplied StylesTables need to have the theme data available</action> <action dev="poi-developers" type="fix">51955 - XSSFReader supplied StylesTables need to have the theme data available</action>

View File

@ -28,21 +28,23 @@ import java.util.zip.ZipFile;
* normal ZipFile implementation is. * normal ZipFile implementation is.
*/ */
public class ZipFileZipEntrySource implements ZipEntrySource { public class ZipFileZipEntrySource implements ZipEntrySource {
private ZipFile zipArchive; private ZipFile zipArchive;
public ZipFileZipEntrySource(ZipFile zipFile) { public ZipFileZipEntrySource(ZipFile zipFile) {
this.zipArchive = zipFile; this.zipArchive = zipFile;
} }
public void close() throws IOException { public void close() throws IOException {
zipArchive.close(); if(zipArchive != null) {
zipArchive = null; zipArchive.close();
} }
zipArchive = null;
public Enumeration<? extends ZipEntry> getEntries() { }
return zipArchive.entries();
} public Enumeration<? extends ZipEntry> getEntries() {
return zipArchive.entries();
public InputStream getInputStream(ZipEntry entry) throws IOException { }
return zipArchive.getInputStream(entry);
} public InputStream getInputStream(ZipEntry entry) throws IOException {
return zipArchive.getInputStream(entry);
}
} }