You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/23 21:52:52 UTC

svn commit: r1126693 - /incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.java

Author: simonetripodi
Date: Mon May 23 19:52:51 2011
New Revision: 1126693

URL: http://svn.apache.org/viewvc?rev=1126693&view=rev
Log:
fixed internal getDeclaredMethod() cache raw type
no needs to mark nulls with null list if returned value is null

Modified:
    incubator/ognl/trunk/src/main/java/org/apache/commons/ognl/OgnlRuntime.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=1126693&r1=1126692&r2=1126693&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 Mon May 23 19:52:51 2011
@@ -19,11 +19,6 @@ package org.apache.commons.ognl;
  * under the License.
  */
 
-import org.apache.commons.ognl.enhance.ExpressionCompiler;
-import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
-import org.apache.commons.ognl.internal.ClassCache;
-import org.apache.commons.ognl.internal.ClassCacheImpl;
-
 import java.beans.BeanInfo;
 import java.beans.IndexedPropertyDescriptor;
 import java.beans.IntrospectionException;
@@ -58,6 +53,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import org.apache.commons.ognl.enhance.ExpressionCompiler;
+import org.apache.commons.ognl.enhance.OgnlExpressionCompiler;
+import org.apache.commons.ognl.internal.ClassCache;
+import org.apache.commons.ognl.internal.ClassCacheImpl;
+
 /**
  * Utility class used by internal OGNL API to do various things like:
  * <ul>
@@ -1897,9 +1897,9 @@ public class OgnlRuntime
 
         synchronized ( cache )
         {
-            Map propertyCache = (Map) cache.get( targetClass );
+            Map<String, List<Method>> propertyCache = cache.get( targetClass );
 
-            if ( ( propertyCache == null ) || ( ( result = (List) propertyCache.get( propertyName ) ) == null ) )
+            if ( ( propertyCache == null ) || ( ( result = propertyCache.get( propertyName ) ) == null ) )
             {
 
                 String baseName = Character.toUpperCase( propertyName.charAt( 0 ) ) + propertyName.substring( 1 );
@@ -1942,12 +1942,12 @@ public class OgnlRuntime
                 }
                 if ( propertyCache == null )
                 {
-                    cache.put( targetClass, propertyCache = new HashMap( 101 ) );
+                    cache.put( targetClass, propertyCache = new HashMap<String, List<Method>>( 101 ) );
                 }
 
-                propertyCache.put( propertyName, ( result == null ) ? NotFoundList : result );
+                propertyCache.put( propertyName, result );
             }
-            return ( result == NotFoundList ) ? null : result;
+            return result;
         }
     }