From ac2b159e6f6085f36728c0e247fa40682096087c Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 04 May 2012 08:13:47 +0000
Subject: [PATCH] Fix OPENDJ-476: Manage Account fails with NPE if target DN does not exist The NPE was occurring parsing the MatchedDN because schema was not initialized.
---
opends/src/server/org/opends/server/tools/ManageAccount.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/ManageAccount.java b/opends/src/server/org/opends/server/tools/ManageAccount.java
index b6f68ae..a0d55eb 100644
--- a/opends/src/server/org/opends/server/tools/ManageAccount.java
+++ b/opends/src/server/org/opends/server/tools/ManageAccount.java
@@ -24,7 +24,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2012 ForgeRock AS
*/
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -64,6 +64,7 @@
PasswordPolicyStateExtendedOperation.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.ToolConstants.*;
+import org.opends.server.util.EmbeddedUtils;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
@@ -858,6 +859,7 @@
StringArgument targetDN;
StringArgument trustStoreFile;
StringArgument trustStorePW;
+ BooleanArgument verbose;
try
{
@@ -975,6 +977,11 @@
INFO_PWPSTATE_DESCRIPTION_TSPWFILE.get());
argParser.addGlobalArgument(trustStorePWFile);
+ verbose = new BooleanArgument("verbose", 'v', "verbose",
+ INFO_DESCRIPTION_VERBOSE.get());
+ verbose.setPropertyName("verbose");
+ argParser.addGlobalArgument(verbose);
+
showUsage = new BooleanArgument(
"showusage", OPTION_SHORT_HELP,
OPTION_LONG_HELP,
@@ -1240,13 +1247,15 @@
// Get the target DN as a string for later use.
targetDNString = targetDN.getValue();
+ // Bootstrap and initialize directory data structures.
+ 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.
LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions();
connectionOptions.setVersionNumber(3);
-
+ connectionOptions.setVerbose(verbose.isPresent());
// If both a bind password and bind password file were provided, then
// return an error.
@@ -1376,7 +1385,7 @@
}
catch (LDAPConnectionException lce)
{
- Message message = null;
+ Message message;
if ((lce.getCause() != null) && (lce.getCause().getCause() != null) &&
lce.getCause().getCause() instanceof SSLException) {
message = ERR_PWPSTATE_CANNOT_CONNECT_SSL.get(host.getValue(),
--
Gitblit v1.10.0