Subject: Re: LDAPMessage.nextElement() in java-api-11

From: "Steve Sonntag" <[email-masked]>
Date: Fri, 29 Sep 2000 10:07:57 -0600

But the question still remains, how do you communicate a timeout
or other LDAP error to the application?

-Steve

>>> Miodrag Kekic <[email-masked]> 28-Sep-00 4:04:07 PM >>>
In out current implementation, we return only LDAPEntries and
LDAPExceptions (including also the LDAPReferralException being an
extension of LDAPException). LDAPResponse messages, are used only for
asynch operations. For synchronous ones, they are converted into
LDAPException and as such delivered to the application.

So the text should be "The returned value may be an LDAPEntry or an
LDAPException or an LDAPReferralException".

Miodrag

Steve Sonntag wrote:

>  As I was looking at LDAPMessage.nextElement()I wondered how the API
> should communicate to theapplication that an  LDAP error has occurred
> on theconnection such as TIMEOUT.  We cannot throwan LDAPException
> because that violates theEnumeration contract. Should the description
> be extended to includereturned value may be     an LDAPEntry, an
> LDAPResponse, or an LDAPReferralException     where an LDAPResponse is
> returned on error cases and encapsulates     the error
> code. -Steve ------------------------
> Steve Sonntag
> Novell, Inc., the leading provider of Net services software

---

From: "Steve Sonntag" <[email-masked]>
Date: Thu, 28 Sep 2000 19:26:59 -0600

to the application?

-Steve

Miodrag

---

From: "Steve Sonntag" <[email-masked]>
Date: Fri, 29 Sep 2000 15:20:13 -0600

Good!  The draft should then be reworded then to change 4.35.5 from

The returned value may be an LDAPEntry or an LDAPReferralException
    to
The returned value may be an LDAPEntry or an LDAPException

-Steve

>>> Miodrag Kekic <[email-masked]> 29-Sep-00 2:22:33 PM >>>
This is done through the LDAPExceptions which are returned as result elements rather than being thrown.  Example: 
      LDAPSearchResults res = ld.search( base,ld.SCOPE_BASE, filter, null,false); 
      while ( res.hasMoreElements() ) { 
        Object o = res.nextElement(); 
        if ( o instanceof LDAPEntry ) { 
          LDAPEntry findEntry = (LDAPEntry)o; 
          System.err.println(findEntry); 
          ... 
        } else if ( o instanceof LDAPReferralException ) { 
          LDAPReferralException e = (LDAPReferralException)o; 
          LDAPUrl refUrls[] = e.getURLs(); 
          ... 
        } else if ( o instanceof LDAPException ) {  
          LDAPException e = (LDAPException)o; 
          // check for the timeout 
          if (e.getLDAPResultCode == e.LDAP_TIMEOUT) { 
           ... 
          } 
          ... 
        } 
Miodrag 
Steve Sonntag wrote: 
 But the question still remains, how do you communicate a timeout 
or other LDAP error to the application? -Steve