directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r345873 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
Date Mon, 21 Nov 2005 09:12:16 GMT
Author: elecharny
Date: Mon Nov 21 01:12:11 2005
New Revision: 345873

URL: http://svn.apache.org/viewcvs?rev=345873&view=rev
Log:
- Protect the code from NPE
- changed the toString() to a (String) cast (2x faster)

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

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java?rev=345873&r1=345872&r2=345873&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
Mon Nov 21 01:12:11 2005
@@ -36,13 +36,18 @@
 {
     public Object normalize( Object value ) throws NamingException
     {
+        if ( value == null )
+        {
+            return null;
+        }
+        
         if ( value instanceof byte[] )
         {
             return StringTools.deepTrimToLower( StringUtils.toUtf8( (byte[])value ) );
         }
         else
         {
-            return StringTools.deepTrimToLower( value.toString() );
+            return StringTools.deepTrimToLower( (String)value );
         }
     }
 }



Mime
View raw message