dev@glassfish.java.net

Re: dangerous code pattern

From: Sreenivas Munnangi <sreenivas.munnangi_at_Sun.COM>
Date: Fri, 31 Mar 2006 09:39:26 -0800

Thanks all for your feedback and the following isssue has been created
to address this issue.

https://glassfish.dev.java.net/issues/show_bug.cgi?id=507


vince.kraemer_at_Sun.COM wrote On 03/31/06 07:50 AM,:

>I have noticed a number of places where there is code like
>
>if (a.b().c().d() != null)
> a.b().c().d().dosomething();
>
>Most of the time this is "safe", but it does open the door to bugs down the road..
>
>The author of this pattern is trusting that b(), c(), and d() are side-effect free.
>
>If the author of those methods were to change them (and introduce a side-effect),
>this client could have a nasty surprise...
>
>Long live intermediate results!
>
>vbk
>
>----- Original Message -----
>From: Scott Oaks <Scott.Oaks_at_Sun.COM>
>Date: Friday, March 31, 2006 7:20 am
>Subject: Re: dangerous code pattern
>
>
>
>>+2
>>
>>On Fri, 2006-03-31 at 10:16, Qingqing Ouyang wrote:
>>
>>
>>>+1
>>>
>>>
>>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
>