You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Daniel Fisher (JIRA)" <ji...@apache.org> on 2014/02/24 22:55:21 UTC

[jira] [Commented] (DIRAPI-122) startTLS does not throw on handshake exceptions

    [ https://issues.apache.org/jira/browse/DIRAPI-122?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13910866#comment-13910866 ] 

Daniel Fisher commented on DIRAPI-122:
--------------------------------------

#startTLS is not fail fast.
Handshake exceptions are not thrown by that method.


> startTLS does not throw on handshake exceptions
> -----------------------------------------------
>
>                 Key: DIRAPI-122
>                 URL: https://issues.apache.org/jira/browse/DIRAPI-122
>             Project: Directory Client API
>          Issue Type: Wish
>    Affects Versions: 1.0.0-M15, 1.0.0-M16
>            Reporter: Daniel Fisher
>            Assignee: Kiran Ayyagari
>
> Invoking LdapNetworkConnection#startTls() does not propagate handshake exceptions out to the caller.
> Instead, an InvalidConnectionException is experienced by the client on the next operation that uses the connection.
> IMO, the call to #startTls() should throw any exception experienced by the extended operation.
> Perhaps the method should also return the extended response, rather than void.
> Sample code, connect to any directory server you don't trust:
> {code}
> import org.apache.directory.ldap.client.api.*;
> public class StartTLS
> {
>   public static void main(String[] args)
>     throws Exception
>   {
>     LdapConnectionConfig lcc = new LdapConnectionConfig();
>     lcc.setLdapHost(args[0]);
>     lcc.setLdapPort(Integer.parseInt(args[1]));
>     LdapNetworkConnection lc = new LdapNetworkConnection(lcc);
>     lc.connect();
>     lc.startTls();
>     System.out.println("StartTLS completed");
>     System.out.println(lc.lookup("uid=foo,dc=example,dc=com"));
>   }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)