Author: mcucchiara
Date: Tue May 17 21:50:32 2011
New Revision: 1104581

URL: http://svn.apache.org/viewvc?rev=1104581&view=rev
Log:
OGNL-9 - Upgrade JUnit to version4 (from now the method name which exactly 
matches the ognl expression takes the precedence)

Modified:
    incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
    
incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java

Modified: 
incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java
URL: 
http://svn.apache.org/viewvc/incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java?rev=1104581&r1=1104580&r2=1104581&view=diff
==============================================================================
--- incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java 
(original)
+++ incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java 
Tue May 17 21:50:32 2011
@@ -2736,15 +2736,20 @@ public class OgnlRuntime
                 if ( ( methods[i].getName().equalsIgnoreCase( name )
                     || methods[i].getName().toLowerCase().equals( name )
                     || methods[i].getName().toLowerCase().equals( "get" + name 
)
-                    || methods[i].getName().toLowerCase().equals( "has" + name 
) || methods[i].getName().toLowerCase().equals( "is"
-                                                                               
                                                    + name ) )
+                    || methods[i].getName().toLowerCase().equals( "has" + name 
)
+                    || methods[i].getName().toLowerCase().equals( "is" + name 
) )
                     && !methods[i].getName().startsWith( "set" ) )
                 {
                     if ( numParms > 0 && 
methods[i].getMethod().getParameterTypes().length == numParms )
                         return methods[i].getMethod();
                     else if ( numParms < 0 )
                     {
-                        if ( ( m != null && m.getParameterTypes().length > 
methods[i].getMethod().getParameterTypes().length )
+                        if ( methods[i].getName().equals( name ) )
+                        {
+                            return methods[i].getMethod();
+                        }
+                        else if ( ( m != null
+                                && m.getParameterTypes().length > 
methods[i].getMethod().getParameterTypes().length )
                             || m == null )
                         {
                             m = methods[i].getMethod();

Modified: 
incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
URL: 
http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java?rev=1104581&r1=1104580&r2=1104581&view=diff
==============================================================================
--- 
incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
 (original)
+++ 
incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/CollectionDirectPropertyTest.java
 Tue May 17 21:50:32 2011
@@ -40,7 +40,7 @@ public class CollectionDirectPropertyTes
         { Arrays.asList( "hello", "world" ), "size", 2 },
         { Arrays.asList( "hello", "world" ), "isEmpty", Boolean.FALSE },
         { Arrays.asList(), "isEmpty", Boolean.TRUE },
-//FIXME        { Arrays.asList( "hello", "world" ), "iterator.next", "hello" },
+        { Arrays.asList( "hello", "world" ), "iterator.next", "hello" },
         { Arrays.asList( "hello", "world" ), "iterator.hasNext", Boolean.TRUE 
},
         { Arrays.asList( "hello", "world" ), "#it = iterator, #it.next, 
#it.next, #it.hasNext", Boolean.FALSE },
         { Arrays.asList( "hello", "world" ), "#it = iterator, #it.next, 
#it.next", "world" },


Reply via email to