From 609077ed606e3b094e303f298e8dca10567bc3e2 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 05 Aug 2016 18:42:07 +0000
Subject: [PATCH] Partial OPENDJ-2625 Convert all code that uses JNDI to use the SDK instead
---
opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java | 51 ++++++---------------------------------------------
1 files changed, 6 insertions(+), 45 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
index 8c0aedd..1e1db17 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java
@@ -36,11 +36,6 @@
import java.util.StringTokenizer;
import java.util.TimeZone;
-import javax.naming.AuthenticationException;
-import javax.naming.CommunicationException;
-import javax.naming.NamingException;
-import javax.naming.NamingSecurityException;
-import javax.naming.NoPermissionException;
import javax.net.ssl.SSLHandshakeException;
import org.forgerock.i18n.LocalizableMessage;
@@ -433,40 +428,6 @@
}
/**
- * Returns a message object for the given NamingException.
- *
- * @param ne
- * The NamingException.
- * @param hostPort
- * The hostPort representation of the server we were contacting when the NamingException occurred.
- * @return A message object for the given NamingException.
- */
- public static LocalizableMessage getMessageForException(NamingException ne, String hostPort) {
- String arg;
- if (ne.getLocalizedMessage() != null) {
- arg = ne.getLocalizedMessage();
- } else if (ne.getExplanation() != null) {
- arg = ne.getExplanation();
- } else {
- arg = ne.toString(true);
- }
-
- if (Utils.isCertificateException(ne)) {
- return INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(hostPort, arg);
- } else if (ne instanceof AuthenticationException) {
- return INFO_CANNOT_CONNECT_TO_REMOTE_AUTHENTICATION.get(hostPort, arg);
- } else if (ne instanceof NoPermissionException) {
- return INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS.get(hostPort, arg);
- } else if (ne instanceof NamingSecurityException) {
- return INFO_CANNOT_CONNECT_TO_REMOTE_PERMISSIONS.get(hostPort, arg);
- } else if (ne instanceof CommunicationException) {
- return ERR_CANNOT_CONNECT_TO_REMOTE_COMMUNICATION.get(hostPort, arg);
- } else {
- return INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC.get(hostPort, arg);
- }
- }
-
- /**
* Returns a message object for the given IOException.
*
* @param e
@@ -639,13 +600,13 @@
}
/**
- * Repeats the given {@link char} n times.
+ * Repeats the given {@code char} n times.
*
* @param charToRepeat
- * The {@link char} to repeat.
+ * The {code char} to repeat.
* @param length
* The repetition count.
- * @return The given {@link char} n times.
+ * @return The given {code char} n times.
*/
public static String repeat(final char charToRepeat, final int length) {
final char[] str = new char[length];
@@ -654,11 +615,11 @@
}
/**
- * Return a {@link ValidationCallback<Integer>} which can be used to validate a port number.
+ * Return a {code ValidationCallback<Integer>} which can be used to validate a port number.
*
* @param defaultPort
* The default value to suggest to the user.
- * @return a {@link ValidationCallback<Integer>} which can be used to validate a port number.
+ * @return a {code ValidationCallback<Integer>} which can be used to validate a port number.
*/
public static ValidationCallback<Integer> portValidationCallback(final int defaultPort) {
return new ValidationCallback<Integer>() {
@@ -707,7 +668,7 @@
* if both provided {@link Argument} are presents in the command line arguments.
*
* @param errors
- * The {@link Collection<LocalizableMessage>} to use to add the conflict error (if occurs).
+ * The {@code Collection<LocalizableMessage>} to use to add the conflict error (if occurs).
* @param arg1
* The first {@link Argument} which should not be present if {@literal arg2} is.
* @param arg2
--
Gitblit v1.10.0