From 92f86826768d4df9eb14367ba07c66af8af9f6b6 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Mon, 20 Jul 2015 09:18:09 +0000
Subject: [PATCH] OPENDJ-1666 CR-7647 forgerock-util 2.0.0 migration

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/AuthenticatedConnectionFactory.java |   44 ++++++++++++++++++++++----------------------
 1 files changed, 22 insertions(+), 22 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 a3013e9..a761491 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
@@ -26,24 +26,24 @@
  */
 package com.forgerock.opendj.cli;
 
+import static org.forgerock.util.Utils.*;
+
 import java.util.concurrent.atomic.AtomicReference;
 
 import org.forgerock.opendj.ldap.AbstractConnectionWrapper;
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.ConnectionFactory;
+import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.LdapException;
 import org.forgerock.opendj.ldap.LdapPromise;
-import org.forgerock.opendj.ldap.IntermediateResponseHandler;
 import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.forgerock.opendj.ldap.responses.BindResult;
+import org.forgerock.util.AsyncFunction;
+import org.forgerock.util.Function;
 import org.forgerock.util.Reject;
-import org.forgerock.util.promise.AsyncFunction;
-import org.forgerock.util.promise.FailureHandler;
-import org.forgerock.util.promise.Function;
+import org.forgerock.util.promise.ExceptionHandler;
 import org.forgerock.util.promise.Promise;
-import org.forgerock.util.promise.SuccessHandler;
-
-import static org.forgerock.util.Utils.*;
+import org.forgerock.util.promise.ResultHandler;
 /**
  * An authenticated connection factory can be used to create pre-authenticated
  * connections to a Directory Server.
@@ -133,21 +133,21 @@
             }
 
             return connection.bindAsync(request)
-                    .onSuccess(new SuccessHandler<BindResult>() {
-                        @Override
-                        public void handleResult(final BindResult result) {
-                            // Save the result.
-                            AuthenticatedConnection.this.result = result;
-                        }
-                    }).onFailure(new FailureHandler<LdapException>() {
-                        @Override
-                        public void handleError(final LdapException error) {
-                            /*
-                             * This connection is now unauthenticated so prevent further use.
-                             */
-                            connection.close();
-                        }
-                    });
+                      .thenOnResult(new ResultHandler<BindResult>() {
+                          @Override
+                          public void handleResult(final BindResult result) {
+                              // Save the result.
+                              AuthenticatedConnection.this.result = result;
+                          }
+                      }).thenOnException(new ExceptionHandler<LdapException>() {
+                          @Override
+                          public void handleException(final LdapException exception) {
+                              /*
+                               * This connection is now unauthenticated so prevent further use.
+                               */
+                              connection.close();
+                          }
+                      });
         }
 
         /**

--
Gitblit v1.10.0