From 466627bf6d29a84a71825af598b7772f64f4b67b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 12 Feb 2008 02:14:18 +0000
Subject: [PATCH] Fix for issue 2923 (setup : nullpointer exception for null value on key store pin)

---
 opendj-sdk/opends/src/messages/messages/tools.properties            |    2 +-
 opendj-sdk/opends/src/messages/messages/quicksetup.properties       |    7 +++++--
 opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java |   17 +++++++++++++++--
 3 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/opendj-sdk/opends/src/messages/messages/quicksetup.properties b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
index a80cd14..37550fd 100644
--- a/opendj-sdk/opends/src/messages/messages/quicksetup.properties
+++ b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-#      Portions Copyright 2006-2008 Sun Microsystems, Inc.
+#      Copyright 2006-2008 Sun Microsystems, Inc.
 
 
 
@@ -278,6 +278,10 @@
 INFO_ERROR_ACCESSING_PKCS12_KEYSTORE=Could not access the PKCS#12 key store. \
  Check that the contents of the file correspond to a valid PKCS#12 key store, \
  that you have access rights to it and that the provided PIN is valid.
+INFO_ERROR_NO_KEYSTORE_PASSWORD=You must provide the PIN of the keystore \
+ to retrieve the certificate to be used by the server.
+INFO_ERROR_EMPTY_KEYSTORE_PASSWORD=The provided PIN of the keystore is \
+ empty.
 INFO_ERROR_APPLY_LDIF_ADD=Error processing add operation of %s: %s
 INFO_ERROR_APPLY_LDIF_DELETE=Error processing delete operation of %s: %s
 INFO_ERROR_APPLY_LDIF_MODIFY=Error processing modification operation of %s: \
@@ -833,7 +837,6 @@
  is not a directory.
 INFO_REVERT_ERROR_NULL_FILES_DIR=The specified reversion archive directory is \
  invalid or could not be determined.
-INFO_REVERT_ERROR_NOT_REVERSION_FILES_DIR=The 
 INFO_REVERT_LAUNCHER_USAGE_DESCRIPTION=This utility reverts the current \
  installation of the Directory Server to a version prior to running the \
  upgrade utility.
diff --git a/opendj-sdk/opends/src/messages/messages/tools.properties b/opendj-sdk/opends/src/messages/messages/tools.properties
index a6cc967..c58604e 100644
--- a/opendj-sdk/opends/src/messages/messages/tools.properties
+++ b/opendj-sdk/opends/src/messages/messages/tools.properties
@@ -20,7 +20,7 @@
 #
 # CDDL HEADER END
 #
-#      Portions Copyright 2006-2008 Sun Microsystems, Inc.
+#      Copyright 2006-2008 Sun Microsystems, Inc.
 
 
 
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java b/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
index e1eac61..2ff4c87 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -1622,7 +1622,18 @@
         errorWithPath = true;
       }
     }
-    if (!errorWithPath)
+    boolean pwdProvided = true;
+    if (pwd == null)
+    {
+      pwdProvided = false;
+      errorMessages.add(INFO_ERROR_NO_KEYSTORE_PASSWORD.get());
+    }
+    else if (pwd.length() == 0)
+    {
+      pwdProvided = false;
+      errorMessages.add(INFO_ERROR_EMPTY_KEYSTORE_PASSWORD.get());
+    }
+    if (!errorWithPath && pwdProvided)
     {
       try
       {
@@ -1927,7 +1938,9 @@
           msg.getDescriptor().equals(INFO_PKCS11_KEYSTORE_DOES_NOT_EXIST) ||
           msg.getDescriptor().equals(INFO_ERROR_ACCESSING_JKS_KEYSTORE) ||
           msg.getDescriptor().equals(INFO_ERROR_ACCESSING_PKCS12_KEYSTORE) ||
-          msg.getDescriptor().equals(INFO_ERROR_ACCESSING_PKCS11_KEYSTORE))
+          msg.getDescriptor().equals(INFO_ERROR_ACCESSING_PKCS11_KEYSTORE) ||
+          msg.getDescriptor().equals(INFO_ERROR_NO_KEYSTORE_PASSWORD) ||
+          msg.getDescriptor().equals(INFO_ERROR_EMPTY_KEYSTORE_PASSWORD))
       {
         found = true;
         break;

--
Gitblit v1.10.0