Revision: 10051
Author:   [email protected]
Date:     Thu Apr 21 10:55:39 2011
Log: Treats last modified time of jar file entries differently for purposes of computing staleness in the Compilation Unit Caches. The timestamp of the .jar file is now used instead of the entries timestamps in the zip file format. Some environments return time values out of sync with the local clock, foiling the staleness computation.

Review at http://gwt-code-reviews.appspot.com/1422802

http://code.google.com/p/google-web-toolkit/source/detail?r=10051

Modified:
/trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java
 /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java Wed Mar 23 12:56:08 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileClassPathEntry.java Thu Apr 21 10:55:39 2011
@@ -105,12 +105,13 @@
private final Map<PathPrefixSet, ZipFileSnapshot> cachedSnapshots = new ReferenceIdentityMap(
       AbstractReferenceMap.WEAK, AbstractReferenceMap.HARD, true);

+  private final long lastModified;
   private final String location;
-
   private final ZipFile zipFile;

   private ZipFileClassPathEntry(File zipFile) throws IOException {
     assert zipFile.isAbsolute();
+    this.lastModified = zipFile.lastModified();
     this.zipFile = new ZipFile(zipFile);
     this.location = zipFile.toURI().toString();
   }
@@ -139,6 +140,10 @@
   public ZipFile getZipFile() {
     return zipFile;
   }
+
+  public long lastModified() {
+    return lastModified;
+  }

   synchronized void index(TreeLogger logger) {
     // Never re-index.
@@ -163,7 +168,7 @@
         continue;
       }
       ZipFileResource zipResource = new ZipFileResource(this,
-          zipEntry.getName(), zipEntry.getTime());
+          zipEntry.getName());
       results.add(zipResource);
       Messages.READ_ZIP_ENTRY.log(logger, zipEntry.getName(), null);
     }
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java Fri Mar 18 10:49:05 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/resource/impl/ZipFileResource.java Thu Apr 21 10:55:39 2011
@@ -30,13 +30,11 @@
   private final ZipFileClassPathEntry classPathEntry;
   private final String path;
   private final String[] pathParts;
-  private long lastModified;
-
- public ZipFileResource(ZipFileClassPathEntry classPathEntry, String path, long lastModified) {
+
+ public ZipFileResource(ZipFileClassPathEntry classPathEntry, String path) {
     this.classPathEntry = classPathEntry;
     this.path = StringInterner.get().intern(path);
     this.pathParts = Strings.splitPath(path);
-    this.lastModified = lastModified;
   }

   @Override
@@ -44,9 +42,13 @@
     return classPathEntry;
   }

+  /**
+ * Returns the lastModified time of the zip file itself. Some build environments contain zip file + * entries that are not time synchronized, causing problems with staleness calculations.
+   */
   @Override
   public long getLastModified() {
-    return lastModified;
+    return classPathEntry.lastModified();
   }

   @Override

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to