OPENDJ-3330 Client tool support for TLS v1.2 : fix issues for status, manage-tasks and dsreplication
manage-tasks: fix NPE after connection error
status: fix support of all protocols
dsreplication: fix of the error message
| | |
| | | package org.forgerock.opendj.ldap; |
| | | |
| | | import static com.forgerock.opendj.ldap.CoreMessages.HBCF_CONNECTION_CLOSED_BY_CLIENT; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.HBCF_HEARTBEAT_FAILED; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.HBCF_HEARTBEAT_TIMEOUT; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.ERR_CONNECTION_UNEXPECTED; |
| | | import static com.forgerock.opendj.ldap.CoreMessages.LDAP_CONNECTION_CONNECT_TIMEOUT; |
| | | import static com.forgerock.opendj.util.StaticUtils.DEFAULT_SCHEDULER; |
| | | import static java.util.concurrent.TimeUnit.*; |
| | |
| | | connectException = newHeartBeatTimeoutError(); |
| | | } else { |
| | | connectException = newLdapException(ResultCode.CLIENT_SIDE_SERVER_DOWN, |
| | | HBCF_HEARTBEAT_FAILED.get(), |
| | | ERR_CONNECTION_UNEXPECTED.get(e), |
| | | e); |
| | | } |
| | | if (promise.tryHandleException(connectException)) { |
| | |
| | | ERR_CERT_NO_MATCH_SUBJECT=The host name contained in the subject DN '%s' \ |
| | | does not match the host name '%s' |
| | | ERR_ATTRIBUTE_PARSER_MISSING_ATTRIBUTE=The entry could not be parsed because the '%s' is missing |
| | | ERR_CONNECTION_UNEXPECTED=An error occurred during establishment of a connection: %s |
| | |
| | | printSummaryTable(); |
| | | return 0; |
| | | } |
| | | } catch (LDAPConnectionException lce) { |
| | | println(INFO_TASKINFO_LDAP_EXCEPTION.get(lce.getMessageObject())); |
| | | } catch (LDAPConnectionException | SSLConnectionException e) { |
| | | println(INFO_TASKINFO_LDAP_EXCEPTION.get(e.getMessageObject())); |
| | | return 1; |
| | | } catch (Exception e) { |
| | | println(LocalizableMessage.raw(StaticUtils.getExceptionMessage(e))); |
| | |
| | | |
| | | import com.forgerock.opendj.cli.ArgumentException; |
| | | import com.forgerock.opendj.cli.ClientException; |
| | | import com.forgerock.opendj.cli.ConnectionFactoryProvider; |
| | | import com.forgerock.opendj.cli.ConsoleApplication; |
| | | import com.forgerock.opendj.cli.IntegerArgument; |
| | | import com.forgerock.opendj.cli.ReturnCode; |
| | |
| | | sslBuilder.setKeyManager(keyManager); |
| | | options.set(SSL_USE_STARTTLS, ci.useStartTLS()); |
| | | options.set(SSL_CONTEXT, sslBuilder.getSSLContext()); |
| | | options.set(SSL_ENABLED_PROTOCOLS, ConnectionFactoryProvider.getDefaultProtocols()); |
| | | |
| | | factory = new LDAPConnectionFactory(hostName, portNumber, options); |
| | | connection = factory.getConnection(); |
| | |
| | | * @param err |
| | | * stream to write error messages |
| | | * @return LDAPConnection created by this class from parsed arguments |
| | | * @throws SSLConnectionException |
| | | * if there was a problem connecting with SSL to the server |
| | | * @throws LDAPConnectionException |
| | | * if there was a problem connecting to the server |
| | | * if there was any other problem connecting to the server |
| | | * @throws ArgumentException |
| | | * if there was a problem indicated by the input arguments |
| | | */ |
| | | public LDAPConnection connect(LDAPConnectionConsoleInteraction ui, PrintStream out, PrintStream err) |
| | | throws LDAPConnectionException, ArgumentException |
| | | throws LDAPConnectionException, SSLConnectionException, ArgumentException |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | err.println(isSSLException(e) ? |
| | | ERR_TASKINFO_LDAP_EXCEPTION_SSL.get(ui.getHostName(), ui.getPortNumber()) : e.getMessageObject()); |
| | | return null; |
| | | throw e; |
| | | } |
| | | } |
| | | |