directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r411913 - /directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java
Date Mon, 05 Jun 2006 20:51:25 GMT
Author: elecharny
Date: Mon Jun  5 13:51:24 2006
New Revision: 411913

URL: http://svn.apache.org/viewvc?rev=411913&view=rev
Log:
- Added logs
- Added a test for null MatchingRule which was generating NPE
- Added a warn in this case

Modified:
    directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java

Modified: directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java?rev=411913&r1=411912&r2=411913&view=diff
==============================================================================
--- directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java
(original)
+++ directory/branches/apacheds/optimization/core/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapAttributeTypeRegistry.java
Mon Jun  5 13:51:24 2006
@@ -29,7 +29,11 @@
 import org.apache.directory.server.core.schema.AttributeTypeRegistryMonitorAdapter;
 import org.apache.directory.server.core.schema.OidRegistry;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
+import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -40,6 +44,8 @@
  */
 public class BootstrapAttributeTypeRegistry implements AttributeTypeRegistry
 {
+    private static final Logger log = LoggerFactory.getLogger( BootstrapAttributeTypeRegistry.class
);
+
     /** maps an OID to an AttributeType */
     private final Map byOid;
     /** maps an OID to a schema name*/
@@ -166,9 +172,24 @@
             for ( Iterator ii = byOid.values().iterator(); ii.hasNext(); /**/ )
             {
                 AttributeType type = ( AttributeType ) ii.next();
-                Normalizer normalizer = type.getEquality().getNormalizer();
+                
+                MatchingRule matchingRule = type.getEquality();
+                
+                Normalizer normalizer = null;
+                
+                if ( matchingRule == null )
+                {
+                    log.warn( "Attribute " + type.getName() + " does not have normalize :
using NoopNormalizer" );
+                    normalizer = new NoOpNormalizer();
+                }
+                else
+                {
+                    normalizer = matchingRule.getNormalizer();
+                }
+                
                 mapping.put( type.getOid(), normalizer );
                 String[] aliases = type.getNames();
+             
                 for ( int jj = 0; jj < aliases.length; jj++ )
                 {
                     mapping.put( aliases[jj], normalizer );



Mime
View raw message