harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tony Wu" <wuyue...@gmail.com>
Subject Re: [general]what do you think about this kind of exception order?
Date Sat, 23 Dec 2006 05:03:43 GMT
Hi Andrew,
Thanks for your advice: )

Yes, it is impl detail, but this is one kind of problem. Thus I yelled
here for getting an agreement to deal with similar problems.

I do incline to follow RI in normal case if possible, but harmony's
impl is better here.
I wonder is it worth doing this trade-off?

On 12/23/06, Andrew Zhang <zhanghuangzhu@gmail.com> wrote:
> On 12/23/06, Tony Wu <wuyuehao@gmail.com> wrote:
> >
> > There are two methods, which throw exceptions in different order.
> >
> > public test1(int a, int b){
> >    if(a>b){
> >        throw AException();
> >    }
> >    synchronized(obj){
> >       if(blabla){
> >           throw BException();
> >       }
> >   }
> > }
> >
> > public test2(int a, int b){
> >   synchronized(obj){
> >       if(blabla){
> >           throw BException();
> >       }
> >       if(a>b){
> >           throw AException();
> >       }
> >   }
> > }
> >
> >
> > test1 checks the parameters before entering the synchronized block, It
> > returns immediately instead of waiting for a lock in the condition
> > which should throw AException. IMHO, test1 is more elegant. The
> > problem is, if RI do something like the test2 where harmony using
> > test1, should we follow RI here? What's your opinion?
>
>
> I think it's implementation detail, and I vote for following RI if possible.
>
> We may discuss specific case one by one. :)
>
> Thanks.
> >
> > --
> > Tony Wu
> > China Software Development Lab, IBM
> >
>
>
>
> --
> Best regards,
> Andrew Zhang
>
>


-- 
Tony Wu
China Software Development Lab, IBM

Mime
View raw message