directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r345876 - /directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/ObjectIdentifierNormalizer.java
Date Mon, 21 Nov 2005 09:14:00 GMT
Author: elecharny
Date: Mon Nov 21 01:13:55 2005
New Revision: 345876

URL: http://svn.apache.org/viewcvs?rev=345876&view=rev
Log:
- Protect the code from NPE
- little improvment of the code

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

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/ObjectIdentifierNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/ObjectIdentifierNormalizer.java?rev=345876&r1=345875&r2=345876&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/ObjectIdentifierNormalizer.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/ObjectIdentifierNormalizer.java
Mon Nov 21 01:13:55 2005
@@ -30,6 +30,11 @@
 {
     public Object normalize( Object value ) throws NamingException
     {
+        if ( value == null )
+        {
+            return null;
+        }
+        
         if (! ( value instanceof String ) )
         {
             return value;
@@ -37,16 +42,13 @@
 
         String str = ( ( String ) value ).trim();
 
-        if ( str == null )
-        {
-            return null;
-        }
-        else if ( str.trim().length() == 0 )
+        if ( str.length() == 0 )
         {
             return "";
         }
         else if ( Character.isDigit( str.charAt( 0 ) ) )
         {
+            // We do this test to avoid a lowerCasing which cost time
             return str;
         }
         else



Mime
View raw message