United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-4651568 Currency pattern for Brazil incorrect
JDK-4651568 : Currency pattern for Brazil incorrect

Details
Type:
Bug
Submit Date:
2002-03-12
Status:
Closed
Updated Date:
2003-06-09
Project Name:
JDK
Resolved Date:
2002-11-17
Component:
globalization
OS:
windows_xp
Sub-Component:
translation
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
1.4.0
Fixed Versions:
1.4.2 (mantis)

Related Reports

Sub Tasks

Description

Name: jl125535			Date: 03/12/2002


FULL PRODUCT VERSION :
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)


FULL OPERATING SYSTEM VERSION :
Microsoft Windows XP [Version 5.1.2600]
Reproduced on Solaris 8 with JDK 1.4.


A DESCRIPTION OF THE PROBLEM :
Here in Brazil we use two decimal places for currency
(#.##0,00), but the pattern returned by
getCurrencyInstance is #.##0,## - which ignores zeros
after the decimal.

EXPECTED VERSUS ACTUAL BEHAVIOR :
Currency pattern expected for Brazil is "R$ #.##0,00".
It is currently returning "R$ #.##0,##".


This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;

class CurrencyTest {

    public static void main (String argv[] )  {
        String expectedCurrencyPattern = "\u00A4 #.##0,00";    
    
        Locale locale = new Locale ("pt", "BR");
        Locale.setDefault(locale);
    
        DecimalFormat formatter = 
            (DecimalFormat) NumberFormat.getCurrencyInstance(locale);

        if (formatter.toLocalizedPattern().equals(expectedCurrencyPattern)) {
            System.out.println ("Passed.");
        } else {
             System.out.println ("Failed Currency pattern." +
                    "  Expected:  " + expectedCurrencyPattern +
                    "  Received:  " + formatter.toLocalizedPattern() );
        }
    }
}


---------- END SOURCE ----------
(Review ID: 143998) 
======================================================================

                                    

Comments
EVALUATION

Kieran, could you please validate the currency pattern for Brazil and fix this in mantis? thx!
###@###.### 2002-09-25


Since this bug also affects i18n testing, please fix it before mantis engineering code freeze.
###@###.### 2002-11-05


###@###.### 2002-11-07

One thing I'm noticing in this bug: in the description , the expected format is "R$ #.##0,00" while ours is apparently giving "R$ #.##0,##". Changing the decimal pattern is no problem, but in our source the format seems to be "#,##0.##" i.e. as well as the '##', we seem to have ',' for the thousands separator and '.' for the deciaml one. 

The strange thing is, the sample code given is printing out our unchanged one as "#.##0,##". It looks like we're getting the right thing for the separators, despite apparently having the wrong string in the code. Does this need to be changed as well, or is it a case of "if it ain't broke......."?


###@###.### 2002-11-08

******** l10n evaluation template - begin ***********

Evaluation :
Fixing the currency pattern for brazilian. Also swaping the decimal, 
thousands separator to match ICU & the customer's description.

sccsdiff info (e.g. sccs diffs -r1.30 1.31 Activator_fr.java):
sccs diffs LocaleElements_pt_BR.java 

------- LocaleElements_pt_BR.java -------
38c38
<                     "\u00A4 #,##0.##;-\u00A4 #,##0.##", // currency
pattern
---
>                     "\u00A4 #.##0,00;-\u00A4 #.##0,00", // currency
pattern

List file(s) to be delivered :
src/share/classes/sun/text/resources/LocaleElements_pt_BR.java

Target Build : 
Mantis

Additional Info :


******** l10n evaluation template - end***********


###@###.### 2002-11-11

Looking at the rest of the currency patterns for the locale data, none of them are localized. Changing pt_BR back to the way it was. 

src/share/classes/sun/text/resources:$ sccs diffs LocaleElements_pt_BR.java

------- LocaleElements_pt_BR.java -------
38c38
<                     "\u00A4 #.##0,00;-\u00A4 #.##0,00", // currency pattern
---
>                     "\u00A4 #,##0.00;-\u00A4 #,##0.00", // currency pattern
                                     
2004-06-11
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
mantis

FIXED IN:
mantis

INTEGRATED IN:
mantis

VERIFIED IN:
mantis-rc


                                     
2004-06-14



Hardware and Software, Engineered to Work Together