harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Yu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-1110) [classlib][text] ChoiceFormat(String) pattern parser differs from RI
Date Tue, 22 Apr 2008 02:49:21 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jim Yu updated HARMONY-1110:
----------------------------

    Attachment: HARMONY-1110.diff

I agree with Denis Kishenko's view point that symbols "|", "#" and "<" should be treated
as reserved ones because of their influence on pattern parse algorithm. And we should put
them in quotes to avoid misunderstandings when they are used in formats. According to my regression
test cases, RI behaves just like that. Now that spec doesn't have specific rules about it,
I think we should follow RI's behavior. I've submitted the patch.

> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
>                 Key: HARMONY-1110
>                 URL: https://issues.apache.org/jira/browse/HARMONY-1110
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Denis Kishenko
>         Attachments: HARMONY-1110.diff
>
>
> Harmony and RI have different pattern parsers implementations of ChoiceFormat class.
Spec hasn't any rules for pattern except a single example
> "-1#is negative| 0#is zero or fraction | 1#is one |1.0<is 1+ |2#is two |2<is more
than 2."
> So we have some differences in pattern processing
> Test ---------------------------------------------------------------------------------------
> import java.text.*;
> public class bug9411 {
>     public static void main(String[] args) {
>         try {
>             System.out.println(new ChoiceFormat("2|").toPattern());
>       } catch (Exception e) {
>              e.printStackTrace();
>       }
>       try {
>           System.out.println(new ChoiceFormat("2#ok #ab").toPattern());
>       } catch (Exception e) {
>            e.printStackTrace();
>       }
>       try {
>         System.out.println(new ChoiceFormat("2#ok <ab").toPattern());
>       } catch (Exception e) {
>          e.printStackTrace();
>       }
>     }
> }
> Output ---------------------------------------------------------------------
> RI
> 0.0#
> java.lang.IllegalArgumentException
>                      	at java.text.ChoiceFormat.applyPattern(ChoiceFormat.java:197)
>                      	at java.text.ChoiceFormat.<init>(ChoiceFormat.java:294)
>                      	at bug9411.main(bug9411.java:12)
> java.lang.IllegalArgumentException
>                      	at java.text.ChoiceFormat.applyPattern(ChoiceFormat.java:197)
>                      	at java.text.ChoiceFormat.<init>(ChoiceFormat.java:294)
>                      	at bug9411.main(bug9411.java:17)
> Harmony
> java.lang.IllegalArgumentException
>                      	at java.text.ChoiceFormat.applyPattern(ChoiceFormat.java:127)
>                      	at java.text.ChoiceFormat.<init>(ChoiceFormat.java:66)
>                      	at bug9411.main(bug9411.java:7)
> 2.0#ok #ab
> 2.0#ok <ab

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


Mime
View raw message