directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r448557 - /directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Date Thu, 21 Sep 2006 14:09:07 GMT
Author: akarasulu
Date: Thu Sep 21 07:09:06 2006
New Revision: 448557

URL: http://svn.apache.org/viewvc?view=rev&rev=448557
Log:
Fixed bug with filter creation where a single matchingAttribute is used in the JNDI provider

Modified:
    directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=448557&r1=448556&r2=448557
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
(original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Thu Sep 21 07:09:06 2006
@@ -474,6 +474,31 @@
             return getNexusProxy().search( target, getEnvironment(), filter, ctls );
         }
 
+        // Handle simple filter expressions without multiple terms
+        if ( matchingAttributes.size() == 1 )
+        {
+            NamingEnumeration list = matchingAttributes.getAll();
+            Attribute attr = ( Attribute ) list.next();
+            list.close();
+            
+            if ( attr.size() == 1 )
+            {
+                Object value = attr.get();
+                SimpleNode node;
+                
+                if ( value instanceof byte[] )
+                {
+                    node = new SimpleNode( attr.getID(), ( byte [] ) value, SimpleNode.EQUALITY
);
+                }
+                else 
+                {
+                    node = new SimpleNode( attr.getID(), ( String ) value, SimpleNode.EQUALITY
);
+                }
+
+                return getNexusProxy().search( target, getEnvironment(), node, ctls );
+            }
+        }
+        
         /*
          * Go through the set of attributes using each attribute value pair as 
          * an attribute value assertion within one big AND filter expression.



Mime
View raw message