From 584e553adecf9201dcbbc3b61c38358a777438a5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 13 Mar 2007 21:01:59 +0000
Subject: [PATCH] Update the LDAPConnection object and the classes that use it to ensure that it can perform an unbind before closing the connection.

---
 opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java
index 294f997..61da732 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/LDAPModify.java
@@ -1051,6 +1051,7 @@
       }
     }
 
+    LDAPModify ldapModify = null;
     try
     {
       if (initializeServer)
@@ -1085,8 +1086,7 @@
                                       connectionOptions, out, err);
       connection.connectToHost(bindDNValue, bindPasswordValue, nextMessageID);
 
-      LDAPModify ldapModify = new LDAPModify(fileNameValue, nextMessageID,
-                                             out, err);
+      ldapModify = new LDAPModify(fileNameValue, nextMessageID, out, err);
       InputStream is = System.in;
       if(fileNameValue != null)
       {
@@ -1123,7 +1123,14 @@
     {
       if(connection != null)
       {
-        connection.close();
+        if (ldapModify == null)
+        {
+          connection.close(null);
+        }
+        else
+        {
+          connection.close(ldapModify.nextMessageID);
+        }
       }
     }
     return 0;

--
Gitblit v1.10.0