You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Denis Kishenko <dk...@gmail.com> on 2006/09/05 10:42:01 UTC

[classlib][text] ChoiceFormat pattern parser compatibility

People what do you think about HARMONY-1110?

Problem is we have to reproduce behavior of ChoiceFormat pattern parser without
specification. There is only one example in Java doc which doesn't
allow understand when RI assumes that pattern is incorrect.

Thanks

-- 
Denis M. Kishenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][text] ChoiceFormat pattern parser compatibility

Posted by Richard Liang <ri...@gmail.com>.
Wow, How many examples do you have? ;-)

As ChoiceFormat is a "format engine", it's impossible to list all the
exceptional cases.
IMHO, maybe we could 1) *guess* the rules behind RI's strange behavior
by adding more test cases. 2)  try our best to implement the rules of
RI. 3) And then, leave this issue as bug-driven, that is, if there are
user applications fail due to the difference between RI and Harmony,
we fix our code.

Does it make sense? Thanks a lot.

Best regards,
Richard


On 9/5/06, Denis Kishenko <dk...@gmail.com> wrote:
> One more example of strange RI behaviour
>
> ---------------------------------------------------------
> import java.text.*;
>
> public class Test {
>
>     static void test(String pattern) {
>         System.err.print("[" + pattern + "] ");
>         try {
>             System.err.println(new ChoiceFormat(pattern).toPattern());
>         } catch (Exception e) {
>             System.err.println(e);
>         }
>     }
>
>     public static void main(String[] args) {
>         test("|||");
>         test("2#a|||");
>         test("1<||||");
>     }
> }
>
> --------------------------------------------- Output
> RI
> [|||] 0.0#|0.0#|0.0#
> [2#a|||] 2.0#a|2.0#|2.0#
> [1<||||] 1.0<|1.0<|1.0<|1.0<
>
> Harmony
> [|||]
> [2#a|||]
> [1<||||]
>
>
> 2006/9/5, Richard Liang <ri...@gmail.com>:
> > On 9/5/06, Denis Kishenko <dk...@gmail.com> wrote:
> > > People what do you think about HARMONY-1110?
> > >
> > > Problem is we have to reproduce behavior of ChoiceFormat pattern parser without
> > > specification. There is only one example in Java doc which doesn't
> > > allow understand when RI assumes that pattern is incorrect.
> > >
> >
> >
> > According the sample in sepc, the rule is very straightforward except
> > there's no explicit description about expcetional cases.
> >
> > IMHO, "2#ok #ab" and "2#ok <ab" are illegal patterns, we shall follow
> > RI. I'm a bit confused about "2|", it's illegal too. But maybe we
> > could also follow RI if it's not too hard to follow RI. ;-)
> >
> > Best regards,
> > Richard
> >
> > > Thanks
> > >
> > > --
> > > Denis M. Kishenko
> > > Intel Middleware Products Division
> > >
> > > ---------------------------------------------------------------------
> > > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> > >
> > >
> >
> >
> > --
> > Richard Liang
> > China Software Development Lab, IBM
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>
> --
> Denis M. Kishenko
> Intel Middleware Products Division
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Richard Liang
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][text] ChoiceFormat pattern parser compatibility

Posted by Denis Kishenko <dk...@gmail.com>.
One more example of strange RI behaviour

---------------------------------------------------------
import java.text.*;

public class Test {

    static void test(String pattern) {
        System.err.print("[" + pattern + "] ");
        try {
            System.err.println(new ChoiceFormat(pattern).toPattern());
        } catch (Exception e) {
            System.err.println(e);
        }
    }

    public static void main(String[] args) {
        test("|||");
        test("2#a|||");
        test("1<||||");
    }
}

--------------------------------------------- Output
RI
[|||] 0.0#|0.0#|0.0#
[2#a|||] 2.0#a|2.0#|2.0#
[1<||||] 1.0<|1.0<|1.0<|1.0<

Harmony
[|||]
[2#a|||]
[1<||||]


2006/9/5, Richard Liang <ri...@gmail.com>:
> On 9/5/06, Denis Kishenko <dk...@gmail.com> wrote:
> > People what do you think about HARMONY-1110?
> >
> > Problem is we have to reproduce behavior of ChoiceFormat pattern parser without
> > specification. There is only one example in Java doc which doesn't
> > allow understand when RI assumes that pattern is incorrect.
> >
>
>
> According the sample in sepc, the rule is very straightforward except
> there's no explicit description about expcetional cases.
>
> IMHO, "2#ok #ab" and "2#ok <ab" are illegal patterns, we shall follow
> RI. I'm a bit confused about "2|", it's illegal too. But maybe we
> could also follow RI if it's not too hard to follow RI. ;-)
>
> Best regards,
> Richard
>
> > Thanks
> >
> > --
> > Denis M. Kishenko
> > Intel Middleware Products Division
> >
> > ---------------------------------------------------------------------
> > Terms of use : http://incubator.apache.org/harmony/mailing.html
> > To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> > For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> >
> >
>
>
> --
> Richard Liang
> China Software Development Lab, IBM
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Denis M. Kishenko
Intel Middleware Products Division

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Re: [classlib][text] ChoiceFormat pattern parser compatibility

Posted by Richard Liang <ri...@gmail.com>.
On 9/5/06, Denis Kishenko <dk...@gmail.com> wrote:
> People what do you think about HARMONY-1110?
>
> Problem is we have to reproduce behavior of ChoiceFormat pattern parser without
> specification. There is only one example in Java doc which doesn't
> allow understand when RI assumes that pattern is incorrect.
>


According the sample in sepc, the rule is very straightforward except
there's no explicit description about expcetional cases.

IMHO, "2#ok #ab" and "2#ok <ab" are illegal patterns, we shall follow
RI. I'm a bit confused about "2|", it's illegal too. But maybe we
could also follow RI if it's not too hard to follow RI. ;-)

Best regards,
Richard

> Thanks
>
> --
> Denis M. Kishenko
> Intel Middleware Products Division
>
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
>
>


-- 
Richard Liang
China Software Development Lab, IBM

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org