You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Simone Tripodi <si...@apache.org> on 2011/11/04 10:24:43 UTC

Re: svn commit: r1197452 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java

Hola Mau!

> URL: http://svn.apache.org/viewvc?rev=1197452&view=rev
> Log:
> OGNL-35 - Flipped equals() everywhere where a variable is tested against a String constant.
>

This is IMHO a very good improvement, expected values first in assertions!

> @@ -168,19 +169,19 @@ public class MapPropertyAccessor
>         {
>             String key = indexStr.replaceAll( "\"", "" );
>
> -            if ( key.equals( "size" ) )
> +            if ( "size".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "keys" ) || key.equals( "keySet" ) )
> +            else if ( "keys".equals( key ) || "keySet".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "values" ) )
> +            else if ( "values".equals( key ) )
>             {
>                 return "";
>             }
> -            else if ( key.equals( "isEmpty" ) )
> +            else if ( "isEmpty".equals( key ) )
>             {
>                 return "";
>             }
>

Can we group all these conditions in just one, since they all return
an empty string?
TIA, have a nice day!
Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/

Re: svn commit: r1197452 - /commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/MapPropertyAccessor.java

Posted by Maurizio Cucchiara <mc...@apache.org>.
Hi Simo,
good catch.
I have just done it

Twitter     :http://www.twitter.com/m_cucchiara
G+          :https://plus.google.com/107903711540963855921
Linkedin    :http://www.linkedin.com/in/mauriziocucchiara

Maurizio Cucchiara



On 4 November 2011 10:24, Simone Tripodi <si...@apache.org> wrote:
> MapPropertyAccessor

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