directory-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Lécharny <elecha...@gmail.com>
Subject Re: LdapConnection.search() Help
Date Wed, 07 Mar 2018 16:49:37 GMT


Le 07/03/2018 à 16:35, George S. a écrit :
> Using 1.0.0 If I run this code:
> 
> EntryCursor cursor=lc.search(base,"(objectclass=*)",SearchScope.ONELEVEL);
> for  (Entry entry : cursor){
>   entries.add(entry);
> } I get this exception. It may be related to referrals. The reason I
> tried this library is because the Novell one was having big problems
> with referrals.


Indeed !

The way the LDAP API will handle referral is by throwing exceptions
(LdapReferralException), so you have to catch it in the loop. The
problem being that if you use a 'for' to loop on the entries, this
exception will be swallowed and you will get a RuntimeException instead.

That is clearly and area we can improve.

In the mean time, using the next()/get() methods, and catching the
LdapReferralException on a get(), that should work.

-- 
Emmanuel Lecharny

Symas.com
directory.apache.org


Mime
View raw message