ICU-9724 Merged #9771 Currency from/to (r32972 - except data jars) and ICU data synchronized with ICU4C maint-50 at r32976.

X-SVN-Rev: 32977
diff --git a/main/classes/core/src/com/ibm/icu/util/Currency.java b/main/classes/core/src/com/ibm/icu/util/Currency.java
index 293bf02..ca648e5 100644
--- a/main/classes/core/src/com/ibm/icu/util/Currency.java
+++ b/main/classes/core/src/com/ibm/icu/util/Currency.java
@@ -29,6 +29,7 @@
 import com.ibm.icu.text.CurrencyMetaInfo;
 import com.ibm.icu.text.CurrencyMetaInfo.CurrencyDigits;
 import com.ibm.icu.text.CurrencyMetaInfo.CurrencyFilter;
+import com.ibm.icu.text.CurrencyMetaInfo.CurrencyInfo;
 import com.ibm.icu.util.ULocale.Category;
 
 /**
@@ -159,9 +160,8 @@
      * @stable ICU 4.0
      */
     public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) {
-        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
         CurrencyFilter filter = CurrencyFilter.onDate(d).withRegion(loc.getCountry());
-        List<String> list = info.currencies(filter);
+        List<String> list = getTenderCurrencies(filter);
         // Note: Prior to 4.4 the spec didn't say that we return null if there are no results, but 
         // the test assumed it did.  Kept the behavior and amended the spec.
         if (list.isEmpty()) {
@@ -356,7 +356,6 @@
             return EMPTY_STRING_ARRAY;
         }
         
-        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
         if (!commonlyUsed) {
             // Behavior change from 4.3.3, no longer sort the currencies
             return getAvailableCurrencyCodes().toArray(new String[0]);
@@ -377,7 +376,7 @@
         
         // currencies are in region's preferred order when we're filtering on region, which
         // matches our spec
-        List<String> result = info.currencies(filter);
+        List<String> result = getTenderCurrencies(filter);
         
         // No fallback anymore (change from 4.3.3)
         if (result.size() == 0) {
@@ -836,16 +835,16 @@
 
     private static SoftReference<List<String>> ALL_CODES;
     /*
-     * Returns an unmodifiable String list including all known currency codes
+     * Returns an unmodifiable String list including all known tender currency codes.
      */
     private static synchronized List<String> getAvailableCurrencyCodes() {
         List<String> all = (ALL_CODES == null) ? null : ALL_CODES.get();
         if (all == null) {
-            CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
             // Filter out non-tender currencies which have "from" date set to 9999-12-31
             // CurrencyFilter has "to" value set to 9998-12-31 in order to exclude them
-            CurrencyFilter filter = CurrencyFilter.onDateRange(null, new Date(253373299200000L));
-            all = Collections.unmodifiableList(info.currencies(filter));
+            //CurrencyFilter filter = CurrencyFilter.onDateRange(null, new Date(253373299200000L));
+            CurrencyFilter filter = CurrencyFilter.all();
+            all = Collections.unmodifiableList(getTenderCurrencies(filter));
             ALL_CODES = new SoftReference<List<String>>(all);
         }
         return all;
@@ -894,5 +893,24 @@
         List<String> allActive = info.currencies(CurrencyFilter.onDateRange(from, to));
         return allActive.contains(code);
     }
+
+    /**
+     * Returns the list of remaining tender currencies after a filter is applied.
+     * @param filter the filter to apply to the tender currencies
+     * @return a list of tender currencies
+     */
+    private static List<String> getTenderCurrencies(CurrencyFilter filter) {
+        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
+        List<CurrencyInfo> infoList = info.currencyInfo(filter);
+        List<String> list = new ArrayList<String>();
+        for (CurrencyInfo currencyInfo : infoList) {
+            // Non-tender currencies always have a from of MIN_VALUE and a to of MAX_VALUE, so
+            // exclude them.
+            if (currencyInfo.from != Long.MIN_VALUE || currencyInfo.to != Long.MAX_VALUE) {
+                list.add(currencyInfo.code);
+            }
+        }
+        return list;
+    }
 }
 //eof
diff --git a/main/classes/currdata/src/com/ibm/icu/impl/ICUCurrencyMetaInfo.java b/main/classes/currdata/src/com/ibm/icu/impl/ICUCurrencyMetaInfo.java
index 338141c..8821704 100644
--- a/main/classes/currdata/src/com/ibm/icu/impl/ICUCurrencyMetaInfo.java
+++ b/main/classes/currdata/src/com/ibm/icu/impl/ICUCurrencyMetaInfo.java
@@ -147,30 +147,7 @@
             return defaultValue;
         }
         int[] values = b.getIntVector();
-        long time = ((long) values[0] << 32) | (((long) values[1]) & MASK);
-        
-        // TODO: remove once errors in CLDR data are fixed.  Or push this into ICU data generation.
-        // The CLDR data parses month as minutes.  We should be getting minutes = 0, so if we detect
-        // that the minute value is nonzero, this means we have bad data and the minute value is really
-        // the month value.
-        GregorianCalendar cal = new GregorianCalendar();
-        cal.setTimeZone(TimeZone.getTimeZone("GMT"));
-        cal.setTimeInMillis(time);
-        int minute = cal.get(Calendar.MINUTE);
-        if (minute != 0) {
-            cal.set(Calendar.MINUTE, 0);
-            cal.set(Calendar.MONTH, minute - 1); // months are 1-based
-            time = cal.getTimeInMillis();
-        }
-        // TODO: generate in CLDR data rather than here, remove endOfDay flag.
-        if (endOfDay) {
-            cal.set(Calendar.HOUR_OF_DAY, 23);
-            cal.set(Calendar.MINUTE, 59);
-            cal.set(Calendar.SECOND, 59);
-            cal.set(Calendar.MILLISECOND, 999);
-            time = cal.getTimeInMillis();
-        }
-        return time;
+        return ((long) values[0] << 32) | (((long) values[1]) & MASK);
     }
 
     // Utility, just because I don't like the n^2 behavior of using list.contains to build a
diff --git a/main/shared/data/icudata.jar b/main/shared/data/icudata.jar
index 955a844..02c965d 100755
--- a/main/shared/data/icudata.jar
+++ b/main/shared/data/icudata.jar
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:eaea8d9da67e9378fa0dd81bbcce71faf3915e7c392e16fb0fce14c63b5fd50a
-size 9758148
+oid sha256:c6dfb005d2ad7f4272663dbdc3b3ffc6210a8941e34cd245dfcd53171ea227dd
+size 9758191
diff --git a/main/shared/data/icutzdata.jar b/main/shared/data/icutzdata.jar
index 62730d2..dbe9ea8 100755
--- a/main/shared/data/icutzdata.jar
+++ b/main/shared/data/icutzdata.jar
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:0fed077fa61db7fe47e5b231de09641e1a9a827c2d9d15916d2af33391631cbe
-size 97787
+oid sha256:fc4258180e2081780d4b97567f4f2f4ccdf18666078a669840b42f93a8564090
+size 97783
diff --git a/main/shared/data/testdata.jar b/main/shared/data/testdata.jar
index 3f7363e..2305640 100755
--- a/main/shared/data/testdata.jar
+++ b/main/shared/data/testdata.jar
@@ -1,3 +1,3 @@
 version https://git-lfs.github.com/spec/v1
-oid sha256:b2409c6f35959bfea4fbdb09a5144ca672308434f91965e29cbef46296619b93
-size 723661
+oid sha256:bf6180a3cd404399287e993a5c2a46c63b8b2817dcfa88a2b8813d23a4247d98
+size 723668
diff --git a/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java b/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
index d490f18..d06550d 100644
--- a/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
+++ b/main/tests/core/src/com/ibm/icu/dev/test/util/DebugUtilitiesData.java
@@ -7,7 +7,7 @@
 package com.ibm.icu.dev.test.util;
 
 public class DebugUtilitiesData extends Object {
-    public static final String ICU4C_VERSION="50.1";
+    public static final String ICU4C_VERSION="50.1.1";
     public static final int UDebugEnumType = 0;
     public static final int UCalendarDateFields = 1;
     public static final int UCalendarMonths = 2;