Reviewers: robertvawter_google.com,

Description:
Description:
============
MhtmlClientBundleGenerator#createResourceContext uses the system time to
generate a strong name, but its ends up creating non-unique names.  This
is probably due to the fact that the system time (in milliseconds)
doesn't change between calls.

Fix:
====
We now use an incrementing counter.

Testing:
========
Manually verified that this works.  Ran full build and tests.

Please review this at http://gwt-code-reviews.appspot.com/88807

Affected files:
    
user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java


Index:  
user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java
===================================================================
---  
user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java
         
(revision 6514)
+++  
user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java
         
(working copy)
@@ -31,6 +31,7 @@
  public class MhtmlClientBundleGenerator extends  
AbstractClientBundleGenerator {

    private static final String BUNDLE_EXTENSION = ".cache.txt";
+  private static int counter = 0;

    private MhtmlResourceContext resourceContext;
    private String partialPath;
@@ -42,10 +43,15 @@
          resourceBundleType);

      /*
+     * We use a counter to ensure that the generated resources have unique
+     * names. Previously we used the system time, but it sometimes led to  
non-
+     * unique names if subsequent calls happened within the same  
millisecond.
+     *
       * TODO: figure out how to make the filename stable based on actual  
content.
       */
+    counter++;
      partialPath =  
Util.computeStrongName(Util.getBytes(resourceBundleType.getQualifiedSourceName()
-        + System.currentTimeMillis()))
+        + counter))
          + BUNDLE_EXTENSION;
      resourceContext.setPartialPath(partialPath);




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

Reply via email to