[Date Prev][Date Next] [Chronological] [Thread] [Top]

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



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 <miodrag@netscape.com> 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

>>> Miodrag Kekic <miodrag@netscape.com> 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