From d94f6d23898f7515e969517f85b8e626667a1e02 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 19 Sep 2014 08:56:38 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1536: Rename ErrorResultException to LdapException and remove ErrorResultIOException
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java | 33 ++++++++++++++++-----------------
1 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java
index 2e11886..6b2e17f 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions copyright 2011-2014 ForgeRock AS.
+ * Portions Copyright 2011-2014 ForgeRock AS.
*/
package com.forgerock.opendj.cli;
@@ -31,7 +31,7 @@
import org.forgerock.opendj.ldap.AbstractConnectionWrapper;
import org.forgerock.opendj.ldap.Connection;
import org.forgerock.opendj.ldap.ConnectionFactory;
-import org.forgerock.opendj.ldap.ErrorResultException;
+import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.FutureResult;
import org.forgerock.opendj.ldap.IntermediateResponseHandler;
import org.forgerock.opendj.ldap.requests.BindRequest;
@@ -61,8 +61,7 @@
* {@code rebind} method.
* <p>
* If the Bind request fails for some reason (e.g. invalid credentials), then
- * the connection attempt will fail and an {@code ErrorResultException} will be
- * thrown.
+ * the connection attempt will fail and an {@link LdapException} will be thrown.
*/
public final class AuthenticatedConnectionFactory implements ConnectionFactory {
@@ -88,13 +87,13 @@
*/
/** {@inheritDoc} */
@Override
- public BindResult bind(BindRequest request) throws ErrorResultException {
+ public BindResult bind(BindRequest request) throws LdapException {
throw new UnsupportedOperationException();
}
/** {@inheritDoc} */
@Override
- public BindResult bind(String name, char[] password) throws ErrorResultException {
+ public BindResult bind(String name, char[] password) throws LdapException {
throw new UnsupportedOperationException();
}
@@ -140,9 +139,9 @@
// Save the result.
AuthenticatedConnection.this.result = result;
}
- }).onFailure(new FailureHandler<ErrorResultException>() {
+ }).onFailure(new FailureHandler<LdapException>() {
@Override
- public void handleError(final ErrorResultException error) {
+ public void handleError(final LdapException error) {
/*
* This connection is now unauthenticated so prevent further use.
*/
@@ -199,7 +198,7 @@
/** {@inheritDoc} */
@Override
- public Connection getConnection() throws ErrorResultException {
+ public Connection getConnection() throws LdapException {
final Connection connection = parentFactory.getConnection();
BindResult bindResult = null;
try {
@@ -219,29 +218,29 @@
/** {@inheritDoc} */
@Override
- public Promise<Connection, ErrorResultException> getConnectionAsync() {
+ public Promise<Connection, LdapException> getConnectionAsync() {
final AtomicReference<Connection> connectionHolder = new AtomicReference<Connection>();
return parentFactory.getConnectionAsync()
.thenAsync(
- new AsyncFunction<Connection, BindResult, ErrorResultException>() {
+ new AsyncFunction<Connection, BindResult, LdapException>() {
@Override
- public Promise<BindResult, ErrorResultException> apply(final Connection connection)
- throws ErrorResultException {
+ public Promise<BindResult, LdapException> apply(final Connection connection)
+ throws LdapException {
connectionHolder.set(connection);
return connection.bindAsync(request);
}
}
).then(
- new Function<BindResult, Connection, ErrorResultException>() {
+ new Function<BindResult, Connection, LdapException>() {
@Override
- public Connection apply(BindResult result) throws ErrorResultException {
+ public Connection apply(BindResult result) throws LdapException {
// FIXME: should make the result unmodifiable.
return new AuthenticatedConnection(connectionHolder.get(), request, result);
}
},
- new Function<ErrorResultException, Connection, ErrorResultException>() {
+ new Function<LdapException, Connection, LdapException>() {
@Override
- public Connection apply(ErrorResultException errorResult) throws ErrorResultException {
+ public Connection apply(LdapException errorResult) throws LdapException {
closeSilently(connectionHolder.get());
throw errorResult;
}
--
Gitblit v1.10.0