You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Alexey Panchenko <al...@olmisoft.com> on 2005/08/08 06:06:05 UTC

Ant task

Hi all,

jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java:

383:            if (locals.size() > 0 && !(locals.size() == 1
384:                                       && locals.get(0) == "")) {

Is there a reason why the Strings are compared using == here and not
equals() ?

-- 
Best regards,
 Alexey                          mailto:alex+news@olmisoft.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant task

Posted by Kev Jackson <ke...@it.fts-vn.com>.
Peter Reilly wrote:

> I do not know if the "" will be interned, it probally will be, but
> the code is misleading, so am replacing it with a 
> "".equals(locals.get(0))
>
> Peter
>
> Kev Jackson wrote:

fair enough ;)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant task

Posted by Peter Reilly <pe...@apache.org>.
I do not know if the "" will be interned, it probally will be, but
the code is misleading, so am replacing it with a "".equals(locals.get(0))

Peter

Kev Jackson wrote:

> Alexey Panchenko wrote:
>
>> Hi all,
>>
>> jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java:
>>
>> 383:            if (locals.size() > 0 && !(locals.size() == 1
>> 384:                                       && locals.get(0) == "")) {
>>
>> Is there a reason why the Strings are compared using == here and not
>> equals() ?
>>
>>  
>>
> I think the logic is that we're checking for a "null" or empty String, 
> using equals for a deep comparison is overkill in this situation no?  
> Could be wrong, but does it create a problem downstream?
>
> Kev
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant task

Posted by Kev Jackson <ke...@it.fts-vn.com>.
Alexey Panchenko wrote:

>Hi all,
>
>jakarta-ant/src/main/org/apache/tools/ant/taskdefs/Ant.java:
>
>383:            if (locals.size() > 0 && !(locals.size() == 1
>384:                                       && locals.get(0) == "")) {
>
>Is there a reason why the Strings are compared using == here and not
>equals() ?
>
>  
>
I think the logic is that we're checking for a "null" or empty String, 
using equals for a deep comparison is overkill in this situation no?  
Could be wrong, but does it create a problem downstream?

Kev

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org