From 766ba6b28669b54a6a90c539822661690cf5fa2d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 25 Nov 2009 20:42:49 +0000
Subject: [PATCH] Fix for issue 4371 (setup throws NullPointerException when trying to use a PKCS12 certificate) Handle the case where the user provides a certificate without an alias. The code in CertificateManager has been updated to detect this situation. The code in ConfigureDS has also been updated to handle the case where the user does not provide a certificate nickname.
---
opends/src/server/org/opends/server/tools/InstallDS.java | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/opends/src/server/org/opends/server/tools/InstallDS.java b/opends/src/server/org/opends/server/tools/InstallDS.java
index 1f66e80..364f010 100644
--- a/opends/src/server/org/opends/server/tools/InstallDS.java
+++ b/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -1961,18 +1961,18 @@
/**
* Checks that the provided parameters are valid to access an existing
- * keystore. This method adds the encountered errors to the provided
+ * key store. This method adds the encountered errors to the provided
* list of Message. It also adds the alias (nicknames) found to the provided
* list of String.
- * @param type the type of keystore.
- * @param path the path of the keystore.
- * @param pwd the password (PIN) to access the keystore.
+ * @param type the type of key store.
+ * @param path the path of the key store.
+ * @param pwd the password (PIN) to access the key store.
* @param certNickname the certificate nickname that we are looking for (or
- * null if we just one to get the one that is in the keystore).
+ * null if we just one to get the one that is in the key store).
* @param errorMessages the list that will be updated with the errors
* encountered.
* @param nicknameList the list that will be updated with the nicknames found
- * in the keystore.
+ * in the key store.
*/
public static void checkCertificateInKeystore(
SecurityOptions.CertificateType type,
@@ -2065,7 +2065,7 @@
throw new IllegalArgumentException("Invalid type: "+type);
}
}
- else
+ else if (certManager.hasRealAliases())
{
for (int i=0; i<aliases.length; i++)
{
@@ -2075,7 +2075,7 @@
", ");
if (certNickname != null)
{
- // Check if the cert alias is in the list.
+ // Check if the certificate alias is in the list.
boolean found = false;
for (int i=0; i<aliases.length && !found; i++)
{
@@ -2096,8 +2096,8 @@
}
catch (KeyStoreException ke)
{
- // Could not access to the keystore: because the password is no good,
- // because the provided file is not a valid keystore, etc.
+ // Could not access to the key store: because the password is no good,
+ // because the provided file is not a valid key store, etc.
switch (type)
{
case JKS:
@@ -2268,7 +2268,7 @@
keystoreAliases);
firstTry = false;
}
- if (certNickname == null)
+ if ((certNickname == null) && !keystoreAliases.isEmpty())
{
certNickname = keystoreAliases.getFirst();
}
--
Gitblit v1.10.0