Revision: 6517
Author: jlaba...@google.com
Date: Wed Oct 28 12:36:51 2009
Log: Ensure that MhtmlClientBundleGenerator#createResourceContext generates  
unique strong names.

Patch by: jlabanca
Review by: bobv


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

Modified:
   
/trunk/user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java

=======================================
---  
/trunk/user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java
  
Wed Oct 28 09:10:53 2009
+++  
/trunk/user/src/com/google/gwt/resources/rebind/context/MhtmlClientBundleGenerator.java
  
Wed Oct 28 12:36:51 2009
@@ -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