Ticket #5952 (closed defect: fixed)

Bug contains 2 commit(s) | SVN Diffs for #5952

 

Opened 2 years ago

Last modified 1 year ago

currency for sr_YU fails

Reported by: srl Assigned to: grhoten
Priority: major Milestone: 4.0
Component: formatting Version: 3.8
Keywords: Cc:
Load: Xref:
Java Version: Operating System:
Project (C/J): ICU4J Weeks:
Review: srl

Description

filed for Oliver Deakin

Ahh I see. I don't open the file directly. I work on the Apache Harmony project and have been looking at what it would take to update to 3.8 (we're on 3.4.4 at the moment). Im seeing a failure in our test code when running with 3.8 which can be demonstrated by the following test case:

import java.util.Locale;
import com.ibm.icu.text.DecimalFormatSymbols;
public class CurrencyTest {
    public static void main(String[] args) {
        Locale locale = new Locale("sr", "YU");
        DecimalFormatSymbols icuSymbols = new 
com.ibm.icu.text.DecimalFormatSymbols(locale);
        System.out.println("Currency symbol=" + 
icuSymbols.getCurrencySymbol()
                + "  Currency=" + icuSymbols.getCurrency());
    }
}

If I run this class with Java 5.0 (J9) with icu4j_3_6_1.jar and icu4j-charsets_3_6_1.jar added to the classpath it completes printing: Currency symbol=YUM Currency=YUM

However if I run again with icu4j_3_8.jar and icu4j_charsets_3_8.jar added to the classpath instead I get the following stack trace:

Exception in thread "main" java.lang.ClassCastException: 
com.ibm.icu.impl.ICUResourceBundleImpl$ResourceArray incompatible with 
java.lang.String
    at java.util.ResourceBundle.getString(ResourceBundle.java:302)
    at com.ibm.icu.util.Currency.createCurrency(Currency.java:166)
    at com.ibm.icu.util.Currency.getInstance(Currency.java:116)
    at 
com.ibm.icu.text.DecimalFormatSymbols.initialize(DecimalFormatSymbols.java:710)
    at 
com.ibm.icu.text.DecimalFormatSymbols.<init>(DecimalFormatSymbols.java:59)
    at CurrencyTest.main(CurrencyTest.java:7)

It appears that we are carrying out a currency lookup for "YU" and failing to find it. I thought this might have been caused by the missing CurrencyData.res file, but perhaps it is because the data for this locale has been left out of supplementalData.res?

Thanks, Oliver

Steven R. Loomis wrote: http://bugs.icu-project.org/trac/ticket/5714 (J) http://bugs.icu-project.org/trac/ticket/5715 (C)

CurrencyData is not used anymore and has been removed, instead supplementalData is used.

Attachments

Change History

09/20/07 08:56:55 changed by srl

Hm. I attempted to fix this code. But then it returns EUR due to the following:

  1. map of YU to CS (serbia and montenegro
  2. following in CLDR currency map:
            <region iso3166="CS">
                <currency iso4217="EUR" from="2003-02-04" to="2006-06-03"/><!-- Montenegro -->
                <currency iso4217="CSD" from="2002-05-15" to="2006-06-03"/><!-- Serbia -->
    

issue:

  1. CS is also obsolete, should be RS (serbia) or ME (montenegro)
  2. by population RSD (serbia) is probably a better return for default currency than EUR (montenegro)

09/20/07 09:15:11 changed by srl

  • status changed from new to assigned.
  • revw set to grhoten.

No longer fails. If EUR is an incorrect return type, please file a new bug.

10/26/07 09:19:14 changed by grhoten

  • owner changed from srl to grhoten.
  • status changed from assigned to new.
  • revw changed from grhoten to srl.

(in reply to: ↑ 4 ; follow-up: ↓ 4 ) 06/05/08 18:01:36 changed by srl

  • status changed from new to closed.
  • resolution set to fixed.

10/06/08 23:19:23 changed by anonymous

10/06/08 23:19:51 changed by anonymous


Add/Change #5952 (currency for sr_YU fails)




Anti spam check: