From 92c3806162a84cdaa7c0d9c9ce5410bc182cbcfb Mon Sep 17 00:00:00 2001
From: fguigues <fguigues@localhost>
Date: Thu, 16 Apr 2009 12:37:36 +0000
Subject: [PATCH] Fix ServiceTag URN for 2.0 Fix ServiceTag Registration adding debug message in case of error Fix 2619 : ldap tools always return 1 in case of argument parsing error Fix 3690 : SNMP: incorrect value for dsServerDescription entry Fix an error in the util script when the install dir is != instance dir

---
 opends/src/server/org/opends/server/tools/LDAPModify.java |   35 ++++++++++++++++++++++-------------
 1 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/LDAPModify.java b/opends/src/server/org/opends/server/tools/LDAPModify.java
index 2760dd6..b324dd3 100644
--- a/opends/src/server/org/opends/server/tools/LDAPModify.java
+++ b/opends/src/server/org/opends/server/tools/LDAPModify.java
@@ -900,7 +900,7 @@
       Message message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
 
       err.println(wrapText(message, MAX_LINE_WIDTH));
-      return 1;
+      return CLIENT_SIDE_PARAM_ERROR;
     }
 
     // Parse the command-line arguments provided to this program.
@@ -914,7 +914,7 @@
 
       err.println(wrapText(message, MAX_LINE_WIDTH));
       err.println(argParser.getUsage());
-      return 1;
+      return CLIENT_SIDE_PARAM_ERROR;
     }
 
     // If we should just display usage or version information,
@@ -930,7 +930,16 @@
               bindPassword.getLongIdentifier(),
               bindPasswordFile.getLongIdentifier());
       err.println(wrapText(message, MAX_LINE_WIDTH));
-      return 1;
+      return CLIENT_SIDE_PARAM_ERROR;
+    }
+
+    if ((!filename.isPresent() &&
+            (argParser.getTrailingArguments().size()==0)))
+    {
+      Message message = ERR_ERROR_PARSING_ARGS.get(filename.getValue());
+      err.println(wrapText(message, MAX_LINE_WIDTH));
+      err.println(argParser.getUsage());
+      return CLIENT_SIDE_PARAM_ERROR;
     }
 
     String hostNameValue = hostName.getValue();
@@ -945,7 +954,7 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, ae);
       }
       err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
-      return 1;
+      return CLIENT_SIDE_PARAM_ERROR;
     }
 
     try
@@ -956,7 +965,7 @@
 
         err.println(wrapText(ERR_DESCRIPTION_INVALID_VERSION.get(
                 String.valueOf(versionNumber)), MAX_LINE_WIDTH));
-        return 1;
+        return CLIENT_SIDE_PARAM_ERROR;
       }
       connectionOptions.setVersionNumber(versionNumber);
     } catch(ArgumentException ae)
@@ -966,7 +975,7 @@
         TRACER.debugCaught(DebugLogLevel.ERROR, ae);
       }
       err.println(wrapText(ae.getMessage(), MAX_LINE_WIDTH));
-      return 1;
+      return CLIENT_SIDE_PARAM_ERROR;
     }
 
     String bindDNValue = bindDN.getValue();
@@ -989,7 +998,7 @@
           TRACER.debugCaught(DebugLogLevel.ERROR, ex);
         }
         err.println(wrapText(ex.getMessage(), MAX_LINE_WIDTH));
-        return 1;
+        return CLIENT_SIDE_PARAM_ERROR;
       }
     } else if(bindPasswordValue == null)
     {
@@ -1036,7 +1045,7 @@
           Message message = ERR_TOOL_INVALID_CONTROL_STRING.get(ctrlString);
           err.println(wrapText(message, MAX_LINE_WIDTH));
           err.println(argParser.getUsage());
-          return 1;
+          return CLIENT_SIDE_PARAM_ERROR;
         }
         modifyOptions.getControls().add(ctrl);
       }
@@ -1067,7 +1076,7 @@
         Message message = ERR_LDAP_ASSERTION_INVALID_FILTER.get(
                 le.getMessage());
         err.println(wrapText(message, MAX_LINE_WIDTH));
-        return 1;
+        return CLIENT_SIDE_PARAM_ERROR;
       }
     }
 
@@ -1113,14 +1122,14 @@
           boolean val = connectionOptions.setSASLMechanism(saslOption);
           if(val == false)
           {
-            return 1;
+            return CLIENT_SIDE_PARAM_ERROR;
           }
         } else
         {
           boolean val = connectionOptions.addSASLProperty(saslOption);
           if(val == false)
           {
-            return 1;
+            return CLIENT_SIDE_PARAM_ERROR;
           }
         }
       }
@@ -1136,13 +1145,13 @@
       {
         Message message = ERR_TOOL_SASLEXTERNAL_NEEDS_SSL_OR_TLS.get();
         err.println(wrapText(message, MAX_LINE_WIDTH));
-        return 1;
+        return CLIENT_SIDE_PARAM_ERROR;
       }
       if(keyStorePathValue == null)
       {
         Message message = ERR_TOOL_SASLEXTERNAL_NEEDS_KEYSTORE.get();
         err.println(wrapText(message, MAX_LINE_WIDTH));
-        return 1;
+        return CLIENT_SIDE_PARAM_ERROR;
       }
     }
 

--
Gitblit v1.10.0