You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Jonathan Lu (JIRA)" <ji...@apache.org> on 2010/09/28 05:23:35 UTC

[jira] Commented: (HARMONY-6655) [classlib][luni]util:currency.getInstance does not throw IllegalArgumentException

    [ https://issues.apache.org/jira/browse/HARMONY-6655?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915601#action_12915601 ] 

Jonathan Lu commented on HARMONY-6655:
--------------------------------------

The ICU lib will check the input as designed. But I think the root cause is the cache 'codesToCurrencies' in Currency, how about just remove the cache and delegate everything to icu Currency?

> [classlib][luni]util:currency.getInstance does not throw IllegalArgumentException
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-6655
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6655
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Jin Yang
>
> executing this code
>    Currency c = Currency.getInstance("ABC");
>    System.out.prvintln(c);
>  we get ABC as output in Harmony where as on SUN ri we get IllegalArgumentException because ABC is not a supported ISO 4217 code.
> In our current design for getInstance(String currencyCode), we do not check the input currencyCode. If we use icu to check, it still doesn't work. ICU just checks if the input is a 3-letter alpha code while not to check if the input is a supported ISO 4217 code. So for ICU, "ABC" is also a valid input.
> I think there will be two ways to fix it:
> 1. ask ICU to check the input.
> 2. maintain a ISO 4217 code list in our implementation and to check the input by ourself. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.