You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/09/21 16:08:03 UTC

svn commit: r448556 - /directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java

Author: akarasulu
Date: Thu Sep 21 07:08:02 2006
New Revision: 448556

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

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

Modified: directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=448556&r1=448555&r2=448556
==============================================================================
--- directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/branches/apacheds/1.0/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Thu Sep 21 07:08:02 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.