directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r492177 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java
Date Wed, 03 Jan 2007 15:29:00 GMT
Author: elecharny
Date: Wed Jan  3 07:28:58 2007
New Revision: 492177

URL: http://svn.apache.org/viewvc?view=rev&rev=492177
Log:
Changed the normalizer to make it use the PrepareString class

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

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java?view=diff&rev=492177&r1=492176&r2=492177
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/DeepTrimToLowerNormalizer.java
Wed Jan  3 07:28:58 2007
@@ -20,6 +20,8 @@
 package org.apache.directory.shared.ldap.schema;
 
 
+import java.io.IOException;
+
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.util.StringTools;
@@ -45,13 +47,22 @@
             return null;
         }
 
-        if ( value instanceof byte[] )
+        try
         {
-            return StringTools.deepTrimToLower( StringTools.utf8ToString( ( byte[] ) value
) );
+            if ( value instanceof byte[] )
+            {
+                return PrepareString.normalize( StringTools.utf8ToString( ( byte[] ) value
), 
+                    PrepareString.StringType.CASE_IGNORE );
+            }
+            else
+            {
+                return PrepareString.normalize( ( String ) value,
+                    PrepareString.StringType.CASE_IGNORE );
+            }
         }
-        else
+        catch ( IOException ioe )
         {
-            return StringTools.deepTrimToLower( ( String ) value );
+            throw new NamingException( "Invalid value : " + value );
         }
     }
 }



Mime
View raw message