You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Denis Kishenko (JIRA)" <ji...@apache.org> on 2006/08/09 10:33:13 UTC
[jira] Created: (HARMONY-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
[classlib][text] ChoiceFormat(String) pattern parser differs from RI
--------------------------------------------------------------------
Key: HARMONY-1110
URL: http://issues.apache.org/jira/browse/HARMONY-1110
Project: Harmony
Issue Type: Bug
Components: Classlib
Reporter: Denis Kishenko
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.
-
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-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1110?page=comments#action_12435706 ]
Denis Kishenko commented on HARMONY-1110:
-----------------------------------------
Spark, which behavior is reasonable depends on point of view. For example for me Harmony is reasonable in the first case while RI is reasonable in the second and third cases.
> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
> Key: HARMONY-1110
> URL: http://issues.apache.org/jira/browse/HARMONY-1110
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
>
> 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.
-
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-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
Posted by "spark shen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1110?page=comments#action_12435622 ]
spark shen commented on HARMONY-1110:
-------------------------------------
On this specific case, seems the behavior of harmony is also reasonable. I suggest to change component to Non-bug difference.
Best regards
> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
> Key: HARMONY-1110
> URL: http://issues.apache.org/jira/browse/HARMONY-1110
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
>
> 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.
-
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-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
Posted by "Denis Kishenko (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1110?page=comments#action_12435709 ]
Denis Kishenko commented on HARMONY-1110:
-----------------------------------------
>From my point of view, symbols "|", "#" and "<" should be reserved as pattern control symbols because they influence of pattern engine algorithm. If user want to use such symbols let's put them in quote to avoid misunderstandings.
2#ok #ab => 2#"ok #ab"
2#ok <ab => 2#"ok <ab"
> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
> Key: HARMONY-1110
> URL: http://issues.apache.org/jira/browse/HARMONY-1110
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
>
> 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.
-
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-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
Posted by "spark shen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1110?page=comments#action_12435721 ]
spark shen commented on HARMONY-1110:
-------------------------------------
Hi Denis Kishenko:
I have forwarded our disscussion onto dev list. Shall we discuss this one there.
Best regards
> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
> Key: HARMONY-1110
> URL: http://issues.apache.org/jira/browse/HARMONY-1110
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
>
> 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.
-
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-1110) [classlib][text]
ChoiceFormat(String) pattern parser differs from RI
Posted by "spark shen (JIRA)" <ji...@apache.org>.
[ http://issues.apache.org/jira/browse/HARMONY-1110?page=comments#action_12435708 ]
spark shen commented on HARMONY-1110:
-------------------------------------
Hi Denis Kishenko
But I totally agree with harmony on 3 cases.
On the first, '2|' indicates that there are 2 choices, but the second one is missing. So throwing an IllegalArgumentException is OK.
On the second and third('2#ok #ab' & '2#ok <ab') there is only one choice. When the formatted thing >= 2, then ok#ab or ok <ab should be used IMHO.
Best regards
> [classlib][text] ChoiceFormat(String) pattern parser differs from RI
> --------------------------------------------------------------------
>
> Key: HARMONY-1110
> URL: http://issues.apache.org/jira/browse/HARMONY-1110
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: Denis Kishenko
>
> 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.
-
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