From bc4dee0c5c9dfaddb36f9aa55298d015cfb0155e Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 27 Jun 2000 11:12:12 +0000 Subject: [PATCH] Store the modification time of the files inside the ZIP file. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@267706 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/Jar.java | 2 +- src/main/org/apache/tools/ant/taskdefs/Zip.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 364cb59b4..37a30402b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -98,7 +98,7 @@ public class Jar extends Zip { InputStream in = this.getClass().getResourceAsStream(s); if ( in == null ) throw new BuildException ( "Could not find: " + s ); - zipFile(in, zOut, "META-INF/MANIFEST.MF"); + zipFile(in, zOut, "META-INF/MANIFEST.MF", System.currentTimeMillis()); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Zip.java b/src/main/org/apache/tools/ant/taskdefs/Zip.java index ab0cc4b81..1af5fc920 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Zip.java +++ b/src/main/org/apache/tools/ant/taskdefs/Zip.java @@ -161,10 +161,12 @@ public class Zip extends MatchingTask { { } - protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath) + protected void zipFile(InputStream in, ZipOutputStream zOut, String vPath, + long lastModified) throws IOException { ZipEntry ze = new ZipEntry(vPath); + ze.setTime(lastModified); /* * XXX ZipOutputStream.putEntry expects the ZipEntry to know its @@ -222,7 +224,7 @@ public class Zip extends MatchingTask { throws IOException { FileInputStream fIn = new FileInputStream(file); - zipFile(fIn, zOut, vPath); + zipFile(fIn, zOut, vPath, file.lastModified()); fIn.close(); } }