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


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6451 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java b/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
index 396cf2f..e7a7cd9 100644
--- a/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
+++ b/user/src/com/google/gwt/i18n/rebind/AbstractLocalizableImplCreator.java
@@ -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 $
diff --git a/user/src/com/google/gwt/i18n/rebind/AbstractResource.java b/user/src/com/google/gwt/i18n/rebind/AbstractResource.java
index 3a81b23..b6c902a 100644
--- a/user/src/com/google/gwt/i18n/rebind/AbstractResource.java
+++ b/user/src/com/google/gwt/i18n/rebind/AbstractResource.java
@@ -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;