bodewig 02/02/08 06:17:24
Modified: src/main/org/apache/tools/ant/taskdefs Zip.java
src/main/org/apache/tools/zip ZipOutputStream.java
Log:
Work around a bug in Kaffe - we can as well label it "optimization" 8-)
Revision Changes Path
1.61 +3 -3
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java
Index: Zip.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Zip.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- Zip.java 26 Jan 2002 19:37:54 -0000 1.60
+++ Zip.java 8 Feb 2002 14:17:24 -0000 1.61
@@ -351,8 +351,8 @@
}
}
}
- } catch (IOException ioe) {
- String msg = "Problem creating " + archiveType + ": " +
ioe.getMessage();
+ } catch (Throwable t) {
+ String msg = "Problem creating " + archiveType + ": " +
t.getMessage();
// delete a bogus ZIP file
if (!zipFile.delete()) {
@@ -366,7 +366,7 @@
}
}
- throw new BuildException(msg, ioe, location);
+ throw new BuildException(msg, t, location);
} finally {
cleanUp();
}
1.5 +13 -3
jakarta-ant/src/main/org/apache/tools/zip/ZipOutputStream.java
Index: ZipOutputStream.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/zip/ZipOutputStream.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ZipOutputStream.java 28 Oct 2001 21:31:01 -0000 1.4
+++ ZipOutputStream.java 8 Feb 2002 14:17:24 -0000 1.5
@@ -1,7 +1,7 @@
/*
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001-2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -80,7 +80,7 @@
* will be called.</p>
*
* @author <a href="[EMAIL PROTECTED]">Stefan Bodewig</a>
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class ZipOutputStream extends DeflaterOutputStream {
@@ -106,6 +106,14 @@
private int level = Deflater.DEFAULT_COMPRESSION;
/**
+ * Has the compression level changed when compared to the last
+ * entry?
+ *
+ * @since 1.5
+ */
+ private boolean hasCompressionLevelChanged = false;
+
+ /**
* Default compression method for next entry.
*
* @since 1.1
@@ -331,8 +339,9 @@
throw new ZipException("crc checksum is required for STORED
method");
}
entry.setComprSize(entry.getSize());
- } else {
+ } else if (hasCompressionLevelChanged) {
def.setLevel(level);
+ hasCompressionLevelChanged = false;
}
writeLocalFileHeader(entry);
}
@@ -354,6 +363,7 @@
* @since 1.1
*/
public void setLevel(int level) {
+ hasCompressionLevelChanged = (this.level != level);
this.level = level;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>