cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anathan...@apache.org
Subject svn commit: r437711 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
Date Mon, 28 Aug 2006 14:01:37 GMT
Author: anathaniel
Date: Mon Aug 28 07:01:36 2006
New Revision: 437711

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

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java?rev=437711&r1=437710&r2=437711&view=diff
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/serialization/ZipArchiveSerializer.java
Mon Aug 28 07:01:36 2006
@@ -263,18 +263,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;
@@ -287,6 +290,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 =



Mime
View raw message