You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey A. Ivanov (JIRA)" <ji...@apache.org> on 2006/07/24 15:57:15 UTC

[jira] Created: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

[text] DecimalFormat ignores settings in DecimalFormatSymbols
-------------------------------------------------------------

                 Key: HARMONY-965
                 URL: http://issues.apache.org/jira/browse/HARMONY-965
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
         Environment: Windows with Russian locale
            Reporter: Alexey A. Ivanov


DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.

Consider the test case:
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;

public class TestDecimalFormat {
    public static void main(String[] args) {
        final DecimalFormat df = new DecimalFormat();
        System.out.println(df.format(1.02));
        
        final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
        dfs.setDecimalSeparator('.');
        df.setDecimalFormatSymbols(dfs);
        System.out.println(df.format(1.02));
        
        System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
    }
}


The ouput on Harmony:
1,02
1,02
1,02


The expected output (when on the RI):
1,02
1.02
1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-965?page=all ]

Paulex Yang closed HARMONY-965.
-------------------------------


Verified by Alexey.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-965?page=all ]

Paulex Yang resolved HARMONY-965.
---------------------------------

    Resolution: Fixed

Alexey, patch applied at revision r425959, thanks a lot for this enhancement. the original patch caused NumberFormatTest fail, but RI failed on same test, so I considered this was test code's bug and fixed it. Please verify the problem is fully resolved as you expected.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-965?page=comments#action_12423615 ] 
            
Alexey A. Ivanov commented on HARMONY-965:
------------------------------------------

One can set another char, e.g. '@', instead of point, to test it in other locales.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-965?page=comments#action_12423977 ] 
            
Paulex Yang commented on HARMONY-965:
-------------------------------------

Sounds reasonable, done at revision r 426359.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-965?page=comments#action_12423836 ] 
            
Alexey A. Ivanov commented on HARMONY-965:
------------------------------------------

Tests pass successfully now.
You should have removed the comment in lines 148-150 in NumberFormatTest which has no meaning any more, since the test at revision r425959 passes on the RI as well as on Harmony.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Alexey A. Ivanov (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-965?page=all ]

Alexey A. Ivanov updated HARMONY-965:
-------------------------------------

    Attachment: DecimalFormat.patch

This patch fixes the issue by copying setting from java.text.DecimalFormatSymbols to com.ibm.icu.text.DecimalFormatSymbols.

The only exception: Currency is not copied. Doing so causes failure of many tests in DecimalFormatTest. I can't figure out how to copy it properly and whether it is needed.

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-965) [text] DecimalFormat ignores settings in DecimalFormatSymbols

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-965?page=all ]

Paulex Yang reassigned HARMONY-965:
-----------------------------------

    Assignee: Paulex Yang

> [text] DecimalFormat ignores settings in DecimalFormatSymbols
> -------------------------------------------------------------
>
>                 Key: HARMONY-965
>                 URL: http://issues.apache.org/jira/browse/HARMONY-965
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>         Environment: Windows with Russian locale
>            Reporter: Alexey A. Ivanov
>         Assigned To: Paulex Yang
>         Attachments: DecimalFormat.patch
>
>
> DecimalFormat ignores settings in DecimalFormatSymbols. It always uses what is set in OS.
> Consider the test case:
> import java.text.DecimalFormat;
> import java.text.DecimalFormatSymbols;
> public class TestDecimalFormat {
>     public static void main(String[] args) {
>         final DecimalFormat df = new DecimalFormat();
>         System.out.println(df.format(1.02));
>         
>         final DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
>         dfs.setDecimalSeparator('.');
>         df.setDecimalFormatSymbols(dfs);
>         System.out.println(df.format(1.02));
>         
>         System.out.println(new DecimalFormat("#.##", dfs).format(1.02));
>     }
> }
> The ouput on Harmony:
> 1,02
> 1,02
> 1,02
> The expected output (when on the RI):
> 1,02
> 1.02
> 1.02

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira