Revision: 6451
Author: [email protected]
Date: Fri Oct 23 11:29:07 2009
Log: Fix a fatal error when asserts are enabled and a locale specified in
@DefaultLocale is not in the current list of locales.

Patch by: jat
Review by: jlabanca

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

Modified:
   
/trunk/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
  /trunk/user/src/com/google/gwt/i18n/rebind/AbstractResource.java

=======================================
---  
/trunk/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java  
 
Wed Jun 24 10:53:23 2009
+++  
/trunk/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java  
 
Fri Oct 23 11:29:07 2009
@@ -109,7 +109,8 @@

      // generated implementations for interface X will be named X_, X_en,
      // X_en_CA, etc.
-    GwtLocale generatedLocale =  
resourceList.findLeastDerivedLocale(locale);
+    GwtLocale generatedLocale = resourceList.findLeastDerivedLocale(logger,
+        locale);
      String localeSuffix = String.valueOf(ResourceFactory.LOCALE_SEPARATOR);
      localeSuffix += generatedLocale.getAsString();
      // Use _ rather than "." in class name, cannot use $
=======================================
--- /trunk/user/src/com/google/gwt/i18n/rebind/AbstractResource.java    Mon  
Oct  5 06:46:07 2009
+++ /trunk/user/src/com/google/gwt/i18n/rebind/AbstractResource.java    Fri  
Oct 23 11:29:07 2009
@@ -132,11 +132,12 @@
      /**
       * From the list of locales matched for any resources in this resource  
list,
       * choose the one that is least derived from the original search  
locale.
-     *
+     * @param logger logger to use
       * @param locale originally requested locale
       * @return least derived matched locale
       */
-    public GwtLocale findLeastDerivedLocale(GwtLocale locale) {
+    public GwtLocale findLeastDerivedLocale(TreeLogger logger,
+        GwtLocale locale) {
        List<GwtLocale> searchList = locale.getCompleteSearchList();
        Map<GwtLocale, Integer> derivedIndex = new HashMap<GwtLocale,  
Integer>();
        for (int i = 0; i < searchList.size(); ++i) {
@@ -148,8 +149,8 @@
          GwtLocale matchLocale = list.get(i).getMatchLocale();
          Integer wrappedIdx = derivedIndex.get(matchLocale);
          if (wrappedIdx == null) {
-          assert false : "Locale " + matchLocale + " not in searchlist "
-              + searchList;
+          logger.log(TreeLogger.WARN, "Locale " + matchLocale
+              + " not in searchlist " + searchList);
            continue;
          }
          int idx = wrappedIdx;

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

Reply via email to