From 9f0eb1a26745e51dc39184882d542583ba4ab7e5 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Wed, 14 Mar 2007 20:32:37 +0000
Subject: [PATCH] Update the LDAP client tools so that they provide error messages in a more readable format.  They can now generate up to four lines of output in the following order:

---
 opends/src/server/org/opends/server/tools/LDAPCompare.java |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/LDAPCompare.java b/opends/src/server/org/opends/server/tools/LDAPCompare.java
index c9cc832..75a82ec 100644
--- a/opends/src/server/org/opends/server/tools/LDAPCompare.java
+++ b/opends/src/server/org/opends/server/tools/LDAPCompare.java
@@ -221,8 +221,9 @@
         else
         {
           msgID = MSGID_OPERATION_FAILED;
-          String msg = getMessage(msgID, "COMPARE", line, ae.getMessage());
+          String msg = getMessage(msgID, "COMPARE");
           err.println(wrapText(msg, MAX_LINE_WIDTH));
+          err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
           return;
         }
       }
@@ -236,8 +237,9 @@
          && !compareOptions.continueOnError())
       {
         msgID = MSGID_OPERATION_FAILED;
-        String msg = getMessage(msgID, "COMPARE", line, errorMessage);
-        throw new LDAPException(resultCode, msgID, msg);
+        String msg = getMessage(msgID, "COMPARE");
+        throw new LDAPException(resultCode, errorMessage, msgID, msg,
+                                op.getMatchedDN(), null);
       } else
       {
         if(resultCode == COMPARE_FALSE)
@@ -251,8 +253,9 @@
         } else
         {
           msgID = MSGID_OPERATION_FAILED;
-          String msg = getMessage(msgID, "COMPARE", line, errorMessage);
-          err.println(wrapText(msg, MAX_LINE_WIDTH));
+          String msg = getMessage(msgID, "COMPARE");
+          LDAPToolUtils.printErrorMessage(err, msg, resultCode, errorMessage,
+                                          op.getMatchedDN());
         }
       }
     }
@@ -868,7 +871,8 @@
       {
         debugCaught(DebugLogLevel.ERROR, le);
       }
-      err.println(wrapText(le.getMessage(), MAX_LINE_WIDTH));
+      LDAPToolUtils.printErrorMessage(err, le.getMessage(), le.getResultCode(),
+                                      le.getErrorMessage(), le.getMatchedDN());
       int code = le.getResultCode();
       return code;
     } catch(LDAPConnectionException lce)
@@ -877,8 +881,11 @@
       {
         debugCaught(DebugLogLevel.ERROR, lce);
       }
-      err.println(wrapText(lce.getMessage(), MAX_LINE_WIDTH));
-      int code = lce.getErrorCode();
+      LDAPToolUtils.printErrorMessage(err, lce.getMessage(),
+                                      lce.getResultCode(),
+                                      lce.getErrorMessage(),
+                                      lce.getMatchedDN());
+      int code = lce.getResultCode();
       return code;
     } catch(Exception e)
     {

--
Gitblit v1.10.0