You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2006/08/28 15:09:43 UTC

svn commit: r437692 - in /cocoon/branches/BRANCH_2_1_X: src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java status.xml

Author: anathaniel
Date: Mon Aug 28 06:09:39 2006
New Revision: 437692

URL: http://svn.apache.org/viewvc?rev=437692&view=rev
Log:
ZipArchiveSerializer: Set time stamp of ZIP entries to last modification time of source file.

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
    cocoon/branches/BRANCH_2_1_X/status.xml

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java?rev=437692&r1=437691&r2=437692&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java Mon Aug 28 06:09:39 2006
@@ -265,18 +265,21 @@
 
         Source source = null;
         try {
-            // Create a new Zip entry
-            ZipEntry entry = new ZipEntry(name);
-            this.zipOutput.putNextEntry(entry);
-
             if (src != null) {
                 // Get the source and its data
                 source = resolver.resolveURI(src);
                 InputStream sourceInput = source.getInputStream();
+
+                // Create a new Zip entry with file modification time.
+                ZipEntry entry = new ZipEntry(name);
+                long lastModified = source.getLastModified();
+                if (lastModified != 0)
+                	entry.setTime(lastModified);
+                this.zipOutput.putNextEntry(entry);
                 
                 // Buffer lazily allocated
                 if (this.buffer == null)
-                    this.buffer = new byte[1024];
+                    this.buffer = new byte[8192];
 
                 // Copy the source to the zip
                 int len;
@@ -289,6 +292,10 @@
                 // close input stream (to avoid "too many open files" problem)
                 sourceInput.close();
             } else {
+                // Create a new Zip entry with current time.
+                ZipEntry entry = new ZipEntry(name);
+                this.zipOutput.putNextEntry(entry);
+
                 // Serialize content
                 if (this.selector == null) {
                     this.selector =

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?rev=437692&r1=437691&r2=437692&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Aug 28 06:09:39 2006
@@ -184,6 +184,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="AN" type="add">
+      ZipArchiveSerializer: Set time stamp of ZIP entries to last modification time of source file.
+    </action>
     <action dev="AG" type="update">
       Updated ehcache to 1.2.2.
     </action>