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/03/26 16:58:20 UTC
svn commit: r758707 -
/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
Author: sebb
Date: Thu Mar 26 15:58:05 2009
New Revision: 758707
URL: http://svn.apache.org/viewvc?rev=758707&view=rev
Log:
Disallow mixed header formats in a single output file
Modified:
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java?rev=758707&r1=758706&r2=758707&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/cpio/CpioArchiveOutputStream.java Thu Mar 26 15:58:05 2009
@@ -64,6 +64,9 @@
private boolean finished;
+ /**
+ * See {@link CpioArchiveEntry#setFormat(short)} for possible values.
+ */
private final short entryFormat;
private final HashMap names = new HashMap();
@@ -142,10 +145,11 @@
e.setTime(System.currentTimeMillis());
}
- // TODO what happens if an entry has an other format than the
- // outputstream?
- if (e.getFormat() == -1) {
+ final short format = e.getFormat();
+ if (format == -1) {
e.setFormat(this.entryFormat);
+ } else if (format != this.entryFormat){
+ throw new IOException("Header format: "+format+" does not match existing format: "+this.entryFormat);
}
if (this.names.put(e.getName(), e) != null) {