directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r345924 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java
Date Mon, 21 Nov 2005 16:10:07 GMT
Author: elecharny
Date: Mon Nov 21 08:10:03 2005
New Revision: 345924

URL: http://svn.apache.org/viewcvs?rev=345924&view=rev
Log:
- Protect the normalize method from NPE
- avoid a double invocation of cache.containsKey

Modified:
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java?rev=345924&r1=345923&r2=345924&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/CachingNormalizer.java
Mon Nov 21 08:10:03 2005
@@ -75,9 +75,16 @@
      */
     public Object normalize( Object value ) throws NamingException
     {
-        if ( cache.containsKey( value ) )
+    	if ( value == null )
+    	{
+    		return null;
+    	}
+    	
+    	Object result = cache.get( value );
+    	
+        if ( result != null )
         {
-            return cache.get( value ) ;
+            return result;
         }
         
         Object normalized = normalizer.normalize( value ) ;



Mime
View raw message