You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2009/04/27 22:35:46 UTC
svn commit: r769150 - in
/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers:
tar/TarArchiveOutputStream.java zip/ZipArchiveOutputStream.java
Author: sebb
Date: Mon Apr 27 20:35:46 2009
New Revision: 769150
URL: http://svn.apache.org/viewvc?rev=769150&view=rev
Log:
Check for closing non-existent entry
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java?rev=769150&r1=769149&r2=769150&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveOutputStream.java Mon Apr 27 20:35:46 2009
@@ -218,6 +218,9 @@
if(finished) {
throw new IOException("Stream has already been finished");
}
+ if (!haveUnclosedEntry){
+ throw new IOException("No current entry to close");
+ }
if (assemLen > 0) {
for (int i = assemLen; i < assemBuf.length; ++i) {
assemBuf[i] = 0;
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java?rev=769150&r1=769149&r2=769150&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveOutputStream.java Mon Apr 27 20:35:46 2009
@@ -364,7 +364,7 @@
}
if (entry == null) {
- return;
+ throw new IOException("No current entry to close");
}
long realCrc = crc.getValue();
@@ -430,7 +430,9 @@
throw new IOException("Stream has already been finished");
}
- closeArchiveEntry();
+ if (entry != null) {
+ closeArchiveEntry();
+ }
entry = ((ZipArchiveEntry) archiveEntry);
entries.add(entry);