From e80072d823b3a54984176c8deff89b6f943d0cc8 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 04 May 2012 11:18:11 +0000
Subject: [PATCH] Fix OPENDJ-476: Manage Account fails with NPE if target DN does not exist Fix precommit tests failure.
---
opends/src/server/org/opends/server/tools/ManageAccount.java | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/ManageAccount.java b/opends/src/server/org/opends/server/tools/ManageAccount.java
index a0d55eb..c9f12fc 100644
--- a/opends/src/server/org/opends/server/tools/ManageAccount.java
+++ b/opends/src/server/org/opends/server/tools/ManageAccount.java
@@ -512,7 +512,7 @@
*/
public static void main(String[] args)
{
- int returnCode = main(args, System.out, System.err);
+ int returnCode = main(args, true, System.out, System.err);
if (returnCode != 0)
{
System.exit(filterExitCode(returnCode));
@@ -526,6 +526,7 @@
* appropriate processing.
*
* @param args The command-line arguments provided to this program.
+ * @param initServer Indicates whether to initialize the server.
* @param outStream The output stream to use for standard output, or
* {@code null} if standard output is not needed.
* @param errStream The output stream to use for standard error, or
@@ -533,9 +534,10 @@
*
* @return A result code indicating whether the processing was successful.
*/
- public static int main(String[] args, OutputStream outStream,
- OutputStream errStream)
+ public static int main(String[] args, Boolean initServer,
+ OutputStream outStream, OutputStream errStream)
{
+
if (outStream == null)
{
out = NullOutputStream.printStream();
@@ -558,7 +560,7 @@
// Parse the command-line arguments provided to the program.
- int result = parseArgsAndConnect(args);
+ int result = parseArgsAndConnect(args, initServer);
if (result < 0)
{
// This should only happen if we're only displaying usage information or
@@ -832,12 +834,14 @@
* Initializes the argument parser for this tool, parses the provided
* arguments, and establishes a connection to the server.
*
+ * @param args Command arguments to parse.
+ * @param initServer Indicates whether to initialize the server.
* @return A result code that indicates the result of the processing. A
* value of zero indicates that all processing completed
* successfully. A value of -1 indicates that only the usage
* information was displayed and no further action is required.
*/
- private static int parseArgsAndConnect(String[] args)
+ private static int parseArgsAndConnect(String[] args, Boolean initServer)
{
argParser = new SubCommandArgumentParser(
CLASS_NAME, INFO_PWPSTATE_TOOL_DESCRIPTION.get(),
@@ -1248,8 +1252,10 @@
targetDNString = targetDN.getValue();
// Bootstrap and initialize directory data structures.
- EmbeddedUtils.initializeForClientUse();
-
+ if (initServer)
+ {
+ EmbeddedUtils.initializeForClientUse();
+ }
// Create the LDAP connection options object, which will be used to
// customize the way that we connect to the server and specify a set of
// basic defaults.
--
Gitblit v1.10.0