Hi, Emmanuel.

Yes, the following code does not return an Entry.  Nothing is printed to my 
console when I use OBJECT.  As soon as I change it to SUBTREE, 1 Entry is 
printed to my console.

I'm observing comparable behavior in Apache Directory Studio.

public Person searchLdapUsingHybridApproach(String query) {
                SearchCursor cursor = new SearchCursorImpl(null, 30000, 
TimeUnit.SECONDS);
        LdapConnection connection = new LdapNetworkConnection(host, port);
        Entry entry = null;
        Person p = null;
        try {
            connection.bind(dn, pwd);
            
            SearchRequest sr = new SearchRequestImpl();
            sr.setBase(new Dn(searchBase));
            StringBuilder sb = new StringBuilder(query);
            sr.setFilter(sb.toString());
            sr.setScope( SearchScope.OBJECT );
            cursor = connection.search(sr);
            Response response;

            while (cursor.next() && cursor.isEntry()) {
                response = cursor.get();
                System.out.println(((SearchResultEntry)response).getEntry());
                entry = cursor.getEntry();
                EntryMapper<Person> em = Person.getEntryMapper();
                    p = em.map(entry);
            }
        } catch (LdapException ex) {
            Logger.getLogger(LdapClient.class.getName()).log(Level.SEVERE, 
null, ex);
        } catch (CursorException ex) {
            Logger.getLogger(LdapClient.class.getName()).log(Level.SEVERE, 
null, ex);
        } finally {
            cursor.close();
            try {
                connection.close();
            } catch (IOException ex) {
                Logger.getLogger(LdapClient.class.getName()).log(Level.SEVERE, 
null, ex);
            }
        }

        return p;
    }

 - Chris

-----Original Message-----
From: Emmanuel Lécharny [mailto:elecha...@gmail.com] 
Sent: Tuesday, January 27, 2015 6:49 PM
To: api@directory.apache.org
Subject: Re: Proper use of LdapConnectionPool

Le 28/01/15 01:27, Harris, Christopher P a écrit :
> O.K.  I think I remember why I stopped looking at the SearchScope.  If I just 
> change the scope to either ONELEVEL or OBJECT, the cursor comes back empty.
ONE_LEVEL applied on a terminal entry will return nothing. With OBJECT, if the 
entry exists, it should work.

If you can test the simplest possible code that grab an entry with OBJECT 
scope, and if it does not work, then it may be a bug, but then, I'd like to 
know about.

The information transmitted is intended only for the person(s) or entity to 
which it is addressed and may contain confidential and/or legally privileged 
material. Delivery of this message to any person other than the intended 
recipient(s) is not intended in any way to waive privilege or confidentiality. 
Any review, retransmission, dissemination or other use of, or taking of any 
action in reliance upon, this information by entities other than the intended 
recipient is prohibited. If you receive this in error, please contact the 
sender and delete the material from any computer.

For Translation:

http://www.baxter.com/email_disclaimer

Reply via email to