directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r582874 - in /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core: event/LeafEvaluator.java event/SubstringEvaluator.java partition/impl/btree/SubstringEnumerator.java
Date Mon, 08 Oct 2007 16:43:37 GMT
Author: elecharny
Date: Mon Oct  8 09:43:36 2007
New Revision: 582874

URL: http://svn.apache.org/viewvc?rev=582874&view=rev
Log:
When the MatchinRule is null, returns the Equality MR a s a default, to avoid NPEs

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java?rev=582874&r1=582873&r2=582874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/LeafEvaluator.java
Mon Oct  8 09:43:36 2007
@@ -305,6 +305,7 @@
     private Comparator getComparator( String attrId ) throws NamingException
     {
         MatchingRule mrule = getMatchingRule( attrId, EQUALITY_MATCH );
+
         return mrule.getComparator();
     }
 
@@ -341,16 +342,24 @@
             case ( EQUALITY_MATCH ):
                 mrule = type.getEquality();
                 break;
+                
             case ( SUBSTRING_MATCH ):
                 mrule = type.getSubstr();
                 break;
+                
             case ( ORDERING_MATCH ):
                 mrule = type.getOrdering();
                 break;
+                
             default:
                 throw new NamingException( "Unknown match type: " + matchType );
         }
 
+        if ( mrule == null )
+        {
+            return type.getEquality();
+        }
+        
         return mrule;
     }
 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java?rev=582874&r1=582873&r2=582874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/event/SubstringEvaluator.java
Mon Oct  8 09:43:36 2007
@@ -33,6 +33,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 
 
@@ -72,7 +73,14 @@
         SubstringNode snode = (SubstringNode)node;
         String oid = oidRegistry.getOid( snode.getAttribute() );
         AttributeType type = attributeTypeRegistry.lookup( oid );
-        Normalizer normalizer = type.getSubstr().getNormalizer();
+        MatchingRule matchingRule = type.getSubstr();
+        
+        if ( matchingRule == null )
+        {
+            matchingRule = type.getEquality();
+        }
+        
+        Normalizer normalizer = matchingRule.getNormalizer();
 
         // get the attribute
         Attribute attr = entry.get( snode.getAttribute() );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java?rev=582874&r1=582873&r2=582874&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/SubstringEnumerator.java
Mon Oct  8 09:43:36 2007
@@ -30,6 +30,7 @@
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.SubstringNode;
 import org.apache.directory.shared.ldap.schema.AttributeType;
+import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 
 
@@ -79,7 +80,14 @@
         Index idx = null;
         final SubstringNode snode = ( SubstringNode ) node;
         AttributeType type = attributeTypeRegistry.lookup( snode.getAttribute() );
-        Normalizer normalizer = type.getSubstr().getNormalizer();
+        MatchingRule matchingRule = type.getSubstr();
+        
+        if ( matchingRule == null )
+        {
+            matchingRule = type.getEquality();
+        }
+        
+        Normalizer normalizer = matchingRule.getNormalizer();
 
         if ( db.hasUserIndexOn( snode.getAttribute() ) )
         {



Mime
View raw message