From a4e2fc0298e8d60aa0e4bcfd3304303d952e0972 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Fri, 28 Nov 2014 14:52:21 +0000
Subject: [PATCH] OPENDJ-1607 Revert changes to revision 11339

---
 opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java |   18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
index 8cc108d..09cf837 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -29,8 +29,7 @@
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
-import static com.forgerock.opendj.ldap.tools.Utils.*;
-
+import static com.forgerock.opendj.ldap.tools.Utils.printErrorMessage;
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.FileInputStream;
@@ -57,7 +56,6 @@
 import org.forgerock.opendj.ldap.controls.PreReadResponseControl;
 import org.forgerock.opendj.ldap.controls.ProxiedAuthV2RequestControl;
 import org.forgerock.opendj.ldap.requests.AddRequest;
-import org.forgerock.opendj.ldap.requests.BindRequest;
 import org.forgerock.opendj.ldap.requests.DeleteRequest;
 import org.forgerock.opendj.ldap.requests.ModifyDNRequest;
 import org.forgerock.opendj.ldap.requests.ModifyRequest;
@@ -250,10 +248,10 @@
     int run(final String[] args) {
         // Create the command-line argument parser for use with this program.
         final LocalizableMessage toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION.get();
-        final ArgumentParser argParser = new ArgumentParser(LDAPModify.class.getName(), toolDescription, false);
+        final ArgumentParser argParser =
+                new ArgumentParser(LDAPModify.class.getName(), toolDescription, false);
         ConnectionFactoryProvider connectionFactoryProvider;
         ConnectionFactory connectionFactory;
-        BindRequest bindRequest;
 
         BooleanArgument continueOnError;
         // TODO: Remove this due to new LDIF reader api?
@@ -368,8 +366,7 @@
                 return 0;
             }
 
-            connectionFactory = connectionFactoryProvider.getConnectionFactory();
-            bindRequest = connectionFactoryProvider.getBindRequest();
+            connectionFactory = connectionFactoryProvider.getAuthenticatedConnectionFactory();
         } catch (final ArgumentException ae) {
             final LocalizableMessage message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
             errPrintln(message);
@@ -459,14 +456,13 @@
         if (!noop.isPresent()) {
             try {
                 connection = connectionFactory.getConnection();
-                if (bindRequest != null) {
-                    printPasswordPolicyResults(this, connection.bind(bindRequest));
-                }
             } catch (final LdapException ere) {
-                return printErrorMessage(this, ere);
+                return Utils.printErrorMessage(this, ere);
             }
         }
 
+        Utils.printPasswordPolicyResults(this, connection);
+
         writer = new LDIFEntryWriter(getOutputStream());
         final VisitorImpl visitor = new VisitorImpl();
         ChangeRecordReader reader = null;

--
Gitblit v1.10.0