From c37b0d815d222d000d2a220e929b488ecff665c3 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Fri, 14 Feb 2014 15:29:34 +0000
Subject: [PATCH]
---
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java | 83 +-
opendj3-server-dev/src/server/org/opends/server/util/cli/ConsoleApplication.java | 88 ++--
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java | 1
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/GetPropSubCommandHandler.java | 21
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/AbstractUpgradeTask.java | 4
opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java | 43 -
opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java | 44 +-
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java | 17
opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java | 55 +-
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java | 95 ++--
opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java | 7
opendj3-server-dev/src/server/org/opends/server/admin/client/cli/TaskScheduleArgs.java | 17
opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java | 33
opendj3-server-dev/src/server/org/opends/server/util/cli/MenuBuilder.java | 12
opendj3-server-dev/src/server/org/opends/server/tools/ManageTasks.java | 24
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java | 2
opendj3-server-dev/src/server/org/opends/server/util/cli/Menu.java | 6
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java | 2
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java | 5
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeLog.java | 6
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java | 35
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTask.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java | 53 +-
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java | 16
opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java | 2
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java | 25
opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java | 39
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java | 1
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java | 22
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java | 4
opendj3-server-dev/src/server/org/opends/server/util/cli/ValidationCallback.java | 6
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java | 9
opendj3-server-dev/src/server/org/opends/server/util/cli/MenuCallback.java | 6
opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java | 345 +++++++-------
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java | 7
opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java | 3
opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java | 4
opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java | 6
opendj3-server-dev/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java | 34
opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 65 +-
opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeContext.java | 14
45 files changed, 653 insertions(+), 628 deletions(-)
diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index e535115..6e00492 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -57,7 +57,6 @@
import org.opends.quicksetup.util.ServerController;
import org.opends.quicksetup.util.Utils;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
-import org.opends.server.tools.ClientException;
import org.opends.server.tools.JavaPropertiesTool.ErrorReturnCode;
import org.opends.server.tools.ToolConstants;
import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
@@ -65,7 +64,7 @@
import org.opends.server.util.cli.*;
import com.forgerock.opendj.cli.ArgumentException;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import static org.forgerock.util.Utils.*;
import static org.opends.messages.AdminToolMessages.*;
@@ -364,7 +363,7 @@
throw new RuntimeException();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
throw new UserDataException(null, ce.getMessageObject(), ce);
@@ -424,7 +423,7 @@
}
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -572,7 +571,7 @@
cancelled = !confirmToStopServer();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -634,7 +633,7 @@
cancelled = !confirmDeleteFiles();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -688,7 +687,7 @@
userData.getStopServer()));
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -704,7 +703,7 @@
{
cancelled = !confirmDeleteFiles();
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -719,9 +718,9 @@
* Ask for confirmation to stop server.
* @return <CODE>true</CODE> if the user wants to continue and stop the
* server. <CODE>false</CODE> otherwise.
- * @throws CLIException if the user reached the confirmation limit.
+ * @throws ClientException if the user reached the confirmation limit.
*/
- private boolean confirmToStopServer() throws CLIException
+ private boolean confirmToStopServer() throws ClientException
{
return askConfirmation(INFO_CLI_UNINSTALL_CONFIRM_STOP.get(), true, logger);
}
@@ -730,9 +729,9 @@
* Ask for confirmation to delete files.
* @return <CODE>true</CODE> if the user wants to continue and delete the
* files. <CODE>false</CODE> otherwise.
- * @throws CLIException if the user reached the confirmation limit.
+ * @throws ClientException if the user reached the confirmation limit.
*/
- private boolean confirmDeleteFiles() throws CLIException
+ private boolean confirmDeleteFiles() throws ClientException
{
return askConfirmation(INFO_CLI_UNINSTALL_CONFIRM_DELETE_FILES.get(), true,
logger);
@@ -742,9 +741,9 @@
* Ask for confirmation to update configuration on remote servers.
* @return <CODE>true</CODE> if the user wants to continue and stop the
* server. <CODE>false</CODE> otherwise.
- * @throws CLIException if the user reached the confirmation limit.
+ * @throws ClientException if the user reached the confirmation limit.
*/
- private boolean confirmToUpdateRemote() throws CLIException
+ private boolean confirmToUpdateRemote() throws ClientException
{
return askConfirmation(INFO_CLI_UNINSTALL_CONFIRM_UPDATE_REMOTE.get(), true,
logger);
@@ -754,9 +753,9 @@
* Ask for confirmation to update configuration on remote servers.
* @return <CODE>true</CODE> if the user wants to continue and stop the
* server. <CODE>false</CODE> otherwise.
- * @throws CLIException if the user reached the confirmation limit.
+ * @throws ClientException if the user reached the confirmation limit.
*/
- private boolean confirmToUpdateRemoteAndStart() throws CLIException
+ private boolean confirmToUpdateRemoteAndStart() throws ClientException
{
return askConfirmation(
INFO_CLI_UNINSTALL_CONFIRM_UPDATE_REMOTE_AND_START.get(), true, logger);
@@ -766,9 +765,9 @@
* Ask for confirmation to provide again authentication.
* @return <CODE>true</CODE> if the user wants to provide authentication
* again. <CODE>false</CODE> otherwise.
- * @throws CLIException if the user reached the confirmation limit.
+ * @throws ClientException if the user reached the confirmation limit.
*/
- private boolean promptToProvideAuthenticationAgain() throws CLIException
+ private boolean promptToProvideAuthenticationAgain() throws ClientException
{
return askConfirmation(
INFO_UNINSTALL_CONFIRM_PROVIDE_AUTHENTICATION_AGAIN.get(), true, logger);
@@ -913,7 +912,7 @@
pwd = null;
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -952,7 +951,7 @@
s = readInput(INFO_UNINSTALL_CLI_REFERENCED_HOSTNAME_PROMPT.get(),
defaultHostName);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: %s", ce), ce);
}
@@ -1262,7 +1261,7 @@
ERR_UNINSTALL_NOT_UPDATE_REMOTE_PROMPT.get(),
false, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
@@ -1376,7 +1375,7 @@
Utils.getMessageFromCollection(exceptionMsgs,
Constants.LINE_SEPARATOR)), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
throw new UserDataException(null, ce.getMessageObject(), ce);
}
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
index ada834e..39b969a 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/CliUserInteraction.java
@@ -34,7 +34,7 @@
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.StaticUtils;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.Menu;
import org.opends.server.util.cli.MenuBuilder;
@@ -138,7 +138,7 @@
throw new RuntimeException();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
respInt = defInt;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
index 352c76f..cae16ca 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -37,7 +37,7 @@
import org.opends.quicksetup.event.ProgressUpdateListener;
import org.opends.quicksetup.event.ProgressUpdateEvent;
import org.opends.server.util.StaticUtils;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
/**
* Class used by Launcher to start a CLI application.
@@ -144,7 +144,7 @@
System.err.println(StaticUtils.wrapText(uude.getLocalizedMessage(),
Utils.getCommandLineMaxLineWidth()));
System.err.println();
- if (uude.getCause() instanceof CLIException)
+ if (uude.getCause() instanceof ClientException)
{
returnValue = ReturnCode.USER_INPUT_ERROR;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/TaskScheduleArgs.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/TaskScheduleArgs.java
index f364845..d39fb81 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/TaskScheduleArgs.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/TaskScheduleArgs.java
@@ -42,10 +42,12 @@
import org.opends.server.backends.task.RecurringTask;
import org.opends.server.types.DirectoryException;
import org.opends.server.util.StaticUtils;
+
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
/**
* A class that contains all the arguments related to the task scheduling.
@@ -173,11 +175,11 @@
* to be launched as a task, the method {@link #validateArgsIfOffline()}
* should be called instead of this method.
* @throws ArgumentException if there is a problem with the arguments.
- * @throws CLIException if there is a problem with one of the values provided
+ * @throws ClientException if there is a problem with one of the values provided
* by the user.
*/
- public void validateArgs()
- throws ArgumentException, CLIException {
+ public void validateArgs() throws ArgumentException, ClientException
+ {
if (startArg.isPresent() && !NOW.equals(startArg.getValue())) {
try {
Date date = StaticUtils.parseDateTimeString(startArg.getValue());
@@ -185,7 +187,7 @@
Date currentDate = new Date(System.currentTimeMillis());
if (currentDate.after(date))
{
- throw new CLIException(ERR_START_DATETIME_ALREADY_PASSED.get(
+ throw new ClientException(ReturnCode.ERROR_USER_DATA, ERR_START_DATETIME_ALREADY_PASSED.get(
startArg.getValue()));
}
} catch (ParseException pe) {
@@ -251,11 +253,10 @@
* This method covers all the checks done by {@link #validateArgs()}, so it
* is not necessary to call that method if this method is being called.
* @throws ArgumentException if there is a problem with the arguments.
- * @throws CLIException if there is a problem with one of the values provided
+ * @throws ClientException if there is a problem with one of the values provided
* by the user.
*/
- public void validateArgsIfOffline()
- throws ArgumentException, CLIException
+ public void validateArgsIfOffline() throws ArgumentException, ClientException
{
Argument[] incompatibleArgs = {startArg, recurringArg,
completionNotificationArg,
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java b/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
index f256582..12cac47 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/BackUpDB.java
@@ -68,7 +68,10 @@
import org.opends.server.util.BuildVersion;
import org.opends.server.util.args.LDAPConnectionArgumentParser;
-import com.forgerock.opendj.cli.*;
+import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.BooleanArgument;
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.StringArgument;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -299,7 +302,7 @@
err.println(argParser.getUsage());
return 1;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
// No need to display the usage since the problem comes with a provided
// value.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java b/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
index 5e015ce..5f9c7ae 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ExportLDIF.java
@@ -60,7 +60,7 @@
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.forgerock.i18n.LocalizableMessage;
@@ -333,7 +333,7 @@
err.println(argParser.getUsage());
return 1;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
// No need to display the usage since the problem comes with a provided
// value.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java b/opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java
index 63f9f92..005d039 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ImportLDIF.java
@@ -83,7 +83,7 @@
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
@@ -431,7 +431,7 @@
err.println(argParser.getUsage());
return 1;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
// No need to display the usage since the problem comes with a provided
// value.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
index 0af6f73..6758322 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/InstallDS.java
@@ -73,7 +73,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.Menu;
import org.opends.server.util.cli.MenuBuilder;
@@ -605,7 +605,7 @@
throw new InitializationException(LocalizableMessage.EMPTY, null);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.error(LocalizableMessage.raw("Unexpected error: "+ce, ce));
throw new InitializationException(LocalizableMessage.EMPTY, null);
@@ -1041,7 +1041,7 @@
dns.add(dn);
prompted = true;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1162,7 +1162,7 @@
{
portNumber = readPort(promptMsg, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
portNumber = -1;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -1234,7 +1234,7 @@
prompt = confirmAction(INFO_INSTALLDS_PROVIDE_BASE_DN_PROMPT.get(),
true);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
prompt = true;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -1297,7 +1297,7 @@
importLDIFFiles.add(path);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1316,7 +1316,7 @@
readInput(INFO_INSTALLDS_PROMPT_REJECTED_FILE.get(),
lastResetRejectedFile);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1336,7 +1336,7 @@
readInput(INFO_INSTALLDS_PROMPT_SKIPPED_FILE.get(),
lastResetSkippedFile);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1438,7 +1438,7 @@
throw new RuntimeException();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
populateType = POPULATE_TYPE_BASE_ONLY;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -1465,7 +1465,7 @@
println(message);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1484,7 +1484,7 @@
rejectedFile =
readInput(INFO_INSTALLDS_PROMPT_REJECTED_FILE.get(), null);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1503,7 +1503,7 @@
skippedFile =
readInput(INFO_INSTALLDS_PROMPT_SKIPPED_FILE.get(), null);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1590,7 +1590,7 @@
INFO_INSTALLDS_PROMPT_LDAPSPORT.get(), usedPorts, false);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1613,7 +1613,7 @@
enableStartTLS = confirmAction(INFO_INSTALLDS_ENABLE_STARTTLS.get(),
defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1732,7 +1732,7 @@
throw new RuntimeException();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
certType = SELF_SIGNED;
@@ -1805,7 +1805,7 @@
false : lastResetEnableWindowsService;
enableService = confirmAction(message, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -1834,7 +1834,7 @@
true : lastResetStartServer;
startServer = confirmAction(message, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
startServer = true;
@@ -2089,7 +2089,7 @@
{
path = readInput(pathPrompt, defaultPathValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
path = "";
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -2299,7 +2299,7 @@
{
s = readInput(prompt, String.valueOf(defaultValue));
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
s = "";
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -2373,7 +2373,7 @@
break;
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
@@ -2535,7 +2535,7 @@
throw new RuntimeException();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
returnValue = ConfirmCode.CANCEL;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -2625,7 +2625,7 @@
hostName = readInput(INFO_INSTALLDS_PROMPT_HOST_NAME.get(),
argParser.hostNameArg.getDefaultValue());
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
index 75b911f..54c4eb1 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPAuthenticationHandler.java
@@ -43,6 +43,7 @@
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.atomic.AtomicInteger;
+
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -53,6 +54,9 @@
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslClient;
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.opendj.ldap.ByteSequence;
import org.forgerock.opendj.ldap.ByteString;
@@ -62,7 +66,6 @@
import org.opends.server.protocols.ldap.ExtendedRequestProtocolOp;
import org.opends.server.protocols.ldap.ExtendedResponseProtocolOp;
import org.opends.server.protocols.ldap.LDAPMessage;
-import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.LDAPException;
import org.opends.server.types.Control;
import org.opends.server.util.Base64;
@@ -310,13 +313,13 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_SEND_SIMPLE_BIND.get(getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_SEND_SIMPLE_BIND.get(getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -330,7 +333,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -338,7 +341,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -346,13 +349,13 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -360,7 +363,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -397,19 +400,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException( LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException( ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse =
responseMessage.getBindResponseProtocolOp();
int resultCode = bindResponse.getResultCode();
- if (resultCode == LDAPResultCode.SUCCESS)
+ if (resultCode == ReturnCode.SUCCESS.get())
{
// FIXME -- Need to look for things like password expiration warning,
// reset notice, etc.
@@ -474,7 +477,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_NO_SASL_MECHANISM.get();
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
@@ -515,7 +518,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_UNSUPPORTED_SASL_MECHANISM.get(mechanism);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_AUTH_UNKNOWN, message);
+ ReturnCode.CLIENT_SIDE_AUTH_UNKNOWN, message);
}
}
@@ -578,7 +581,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_TRACE_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -587,7 +590,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_INVALID_SASL_PROPERTY.get(
name, SASL_MECHANISM_ANONYMOUS);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -621,13 +624,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_ANONYMOUS, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_ANONYMOUS, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -641,7 +644,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -649,7 +652,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -657,13 +660,13 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -671,7 +674,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -708,19 +711,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse =
responseMessage.getBindResponseProtocolOp();
int resultCode = bindResponse.getResultCode();
- if (resultCode == LDAPResultCode.SUCCESS)
+ if (resultCode == ReturnCode.SUCCESS.get())
{
// FIXME -- Need to look for things like password expiration warning,
// reset notice, etc.
@@ -801,7 +804,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_NO_SASL_PROPERTIES.get(SASL_MECHANISM_CRAM_MD5);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
Iterator<String> propertyNames = saslProperties.keySet().iterator();
@@ -821,7 +824,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -831,7 +834,7 @@
LocalizableMessage message = ERR_LDAPAUTH_INVALID_SASL_PROPERTY.get(
name, SASL_MECHANISM_CRAM_MD5);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
}
@@ -842,7 +845,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(SASL_MECHANISM_CRAM_MD5);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
@@ -873,13 +876,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_INITIAL_SASL_BIND.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_INITIAL_SASL_BIND.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -893,7 +896,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -902,7 +905,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -910,13 +913,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -924,7 +927,7 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -952,12 +955,12 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage1.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
@@ -966,7 +969,7 @@
BindResponseProtocolOp bindResponse1 =
responseMessage1.getBindResponseProtocolOp();
int resultCode1 = bindResponse1.getResultCode();
- if (resultCode1 != LDAPResultCode.SASL_BIND_IN_PROGRESS)
+ if (resultCode1 != ReturnCode.SASL_BIND_IN_PROGRESS.get())
{
LocalizableMessage errorMessage = bindResponse1.getErrorMessage();
if (errorMessage == null)
@@ -976,7 +979,7 @@
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_INITIAL_BIND_RESPONSE.
get(SASL_MECHANISM_CRAM_MD5, resultCode1,
- LDAPResultCode.toString(resultCode1), errorMessage);
+ ReturnCode.get(resultCode1), errorMessage);
throw new LDAPException(resultCode1, errorMessage, message,
bindResponse1.getMatchedDN(), null);
}
@@ -988,7 +991,7 @@
if (serverChallenge == null)
{
LocalizableMessage message = ERR_LDAPAUTH_NO_CRAMMD5_SERVER_CREDENTIALS.get();
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
@@ -1017,14 +1020,14 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SECOND_SASL_BIND.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SECOND_SASL_BIND.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -1037,7 +1040,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -1046,7 +1049,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -1054,13 +1057,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -1068,7 +1071,7 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_CRAM_MD5, getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -1105,19 +1108,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage2.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse2 =
responseMessage2.getBindResponseProtocolOp();
int resultCode2 = bindResponse2.getResultCode();
- if (resultCode2 == LDAPResultCode.SUCCESS)
+ if (resultCode2 == ReturnCode.SUCCESS.get())
{
// FIXME -- Need to look for things like password expiration warning,
// reset notice, etc.
@@ -1163,7 +1166,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_INITIALIZE_MD5_DIGEST.get(
getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
}
@@ -1297,7 +1300,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_NO_SASL_PROPERTIES.get(SASL_MECHANISM_DIGEST_MD5);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
@@ -1318,7 +1321,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1335,7 +1338,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_REALM_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1351,7 +1354,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_QOP_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
@@ -1363,14 +1366,14 @@
{
// FIXME -- Add support for integrity and confidentiality.
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_QOP_NOT_SUPPORTED.get(qop);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
else
{
// This is an illegal value.
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_INVALID_QOP.get(qop);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1386,7 +1389,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_DIGEST_URI_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1402,7 +1405,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHZID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1411,7 +1414,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_INVALID_SASL_PROPERTY.get(
name, SASL_MECHANISM_DIGEST_MD5);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1422,7 +1425,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(SASL_MECHANISM_DIGEST_MD5);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
@@ -1454,13 +1457,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_INITIAL_SASL_BIND.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_INITIAL_SASL_BIND.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -1474,7 +1477,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -1483,7 +1486,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -1491,13 +1494,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -1505,7 +1508,7 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_INITIAL_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -1533,12 +1536,12 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage1.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
@@ -1547,7 +1550,7 @@
BindResponseProtocolOp bindResponse1 =
responseMessage1.getBindResponseProtocolOp();
int resultCode1 = bindResponse1.getResultCode();
- if (resultCode1 != LDAPResultCode.SASL_BIND_IN_PROGRESS)
+ if (resultCode1 != ReturnCode.SASL_BIND_IN_PROGRESS.get())
{
LocalizableMessage errorMessage = bindResponse1.getErrorMessage();
if (errorMessage == null)
@@ -1557,7 +1560,7 @@
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_INITIAL_BIND_RESPONSE.
get(SASL_MECHANISM_DIGEST_MD5, resultCode1,
- LDAPResultCode.toString(resultCode1), errorMessage);
+ ReturnCode.get(resultCode1), errorMessage);
throw new LDAPException(resultCode1, errorMessage, message,
bindResponse1.getMatchedDN(), null);
}
@@ -1570,7 +1573,7 @@
if (serverCredentials == null)
{
LocalizableMessage message = ERR_LDAPAUTH_NO_DIGESTMD5_SERVER_CREDENTIALS.get();
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
@@ -1594,7 +1597,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_DIGESTMD5_INVALID_TOKEN_IN_CREDENTIALS.get(
credString, pos);
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
@@ -1611,7 +1614,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_DIGESTMD5_INVALID_CHARSET.get(tokenValue);
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
useUTF8 = true;
@@ -1659,7 +1662,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_REQUESTED_QOP_NOT_SUPPORTED_BY_SERVER.
get(qop, tokenValue);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -1677,7 +1680,7 @@
if (nonce == null)
{
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_NO_NONCE.get();
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
@@ -1706,7 +1709,7 @@
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_CANNOT_CREATE_RESPONSE_DIGEST.
get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -1767,13 +1770,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SECOND_SASL_BIND.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SECOND_SASL_BIND.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -1787,7 +1790,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -1796,7 +1799,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -1804,13 +1807,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -1818,7 +1821,7 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_SECOND_BIND_RESPONSE.get(
SASL_MECHANISM_DIGEST_MD5, getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -1855,19 +1858,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage2.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse2 =
responseMessage2.getBindResponseProtocolOp();
int resultCode2 = bindResponse2.getResultCode();
- if (resultCode2 != LDAPResultCode.SUCCESS)
+ if (resultCode2 != ReturnCode.SUCCESS.get())
{
// FIXME -- Add support for referrals.
@@ -1885,14 +1888,14 @@
if (rspAuthCreds == null)
{
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_NO_RSPAUTH_CREDS.get();
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
String credStr = toLowerCase(rspAuthCreds.toString());
if (! credStr.startsWith("rspauth="))
{
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_NO_RSPAUTH_CREDS.get();
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
@@ -1905,7 +1908,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_COULD_NOT_DECODE_RSPAUTH.get(
getExceptionMessage(e));
- throw new LDAPException(LDAPResultCode.PROTOCOL_ERROR, message);
+ throw new LDAPException(ReturnCode.PROTOCOL_ERROR.get(), message);
}
byte[] clientRspAuth;
@@ -1921,14 +1924,14 @@
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_COULD_NOT_CALCULATE_RSPAUTH.get(
getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
if (! Arrays.equals(serverRspAuth, clientRspAuth))
{
LocalizableMessage message = ERR_LDAPAUTH_DIGESTMD5_RSPAUTH_MISMATCH.get();
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
// FIXME -- Need to look for things like password expiration warning,
@@ -2054,7 +2057,7 @@
// is not fine.
LocalizableMessage message =
ERR_LDAPAUTH_DIGESTMD5_INVALID_CLOSING_QUOTE_POS.get((pos-2));
- throw new LDAPException(LDAPResultCode.INVALID_CREDENTIALS,
+ throw new LDAPException(ReturnCode.INVALID_CREDENTIALS.get(),
message);
}
}
@@ -2152,7 +2155,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_INITIALIZE_MD5_DIGEST.get(
getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
}
@@ -2411,7 +2414,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_NO_ALLOWED_SASL_PROPERTIES.get(SASL_MECHANISM_EXTERNAL);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
@@ -2432,13 +2435,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_EXTERNAL, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_EXTERNAL, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -2452,7 +2455,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -2461,20 +2464,20 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_DECODING_ERROR, message, e);
}
catch (IOException ioe)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -2482,7 +2485,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -2519,19 +2522,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse =
responseMessage.getBindResponseProtocolOp();
int resultCode = bindResponse.getResultCode();
- if (resultCode == LDAPResultCode.SUCCESS)
+ if (resultCode == ReturnCode.SUCCESS.get())
{
// FIXME -- Need to look for things like password expiration warning,
// reset notice, etc.
@@ -2624,7 +2627,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_NO_SASL_PROPERTIES.get(SASL_MECHANISM_GSSAPI);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
Iterator<String> propertyNames = saslProperties.keySet().iterator();
@@ -2644,7 +2647,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2660,7 +2663,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHZID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2676,7 +2679,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_KDC_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2692,7 +2695,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_QOP_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
@@ -2706,14 +2709,14 @@
// FIXME -- Add support for integrity and confidentiality.
LocalizableMessage message =
ERR_LDAPAUTH_DIGESTMD5_QOP_NOT_SUPPORTED.get(gssapiQoP);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
else
{
// This is an illegal value.
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_INVALID_QOP.get(gssapiQoP);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2729,7 +2732,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_REALM_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2739,7 +2742,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_INVALID_SASL_PROPERTY.get(name, SASL_MECHANISM_GSSAPI);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
}
@@ -2750,7 +2753,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(SASL_MECHANISM_GSSAPI);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
@@ -2805,7 +2808,7 @@
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_CANNOT_CREATE_JAAS_CONFIG.get(
getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
System.setProperty(JAAS_PROPERTY_CONFIG_FILE, configFileName);
@@ -2825,7 +2828,7 @@
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_LOCAL_AUTHENTICATION_FAILED.get(
getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
try
@@ -2846,7 +2849,7 @@
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_REMOTE_AUTHENTICATION_FAILED.get(
getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -2929,7 +2932,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_NO_SASL_PROPERTIES.get(SASL_MECHANISM_PLAIN);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
Iterator<String> propertyNames = saslProperties.keySet().iterator();
@@ -2949,7 +2952,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2965,7 +2968,7 @@
if (iterator.hasNext())
{
LocalizableMessage message = ERR_LDAPAUTH_AUTHZID_SINGLE_VALUED.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_PARAM_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_PARAM_ERROR,
message);
}
}
@@ -2975,7 +2978,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_INVALID_SASL_PROPERTY.get(name, SASL_MECHANISM_PLAIN);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
}
@@ -2986,7 +2989,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(SASL_MECHANISM_PLAIN);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_PARAM_ERROR, message);
+ ReturnCode.CLIENT_SIDE_PARAM_ERROR, message);
}
@@ -3026,13 +3029,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_PLAIN, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_PLAIN, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -3046,7 +3049,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -3054,7 +3057,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -3062,13 +3065,13 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -3076,7 +3079,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -3113,19 +3116,19 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
BindResponseProtocolOp bindResponse =
responseMessage.getBindResponseProtocolOp();
int resultCode = bindResponse.getResultCode();
- if (resultCode == LDAPResultCode.SUCCESS)
+ if (resultCode == ReturnCode.SUCCESS.get())
{
// FIXME -- Need to look for things like password expiration warning,
// reset notice, etc.
@@ -3186,7 +3189,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_NONSASL_RUN_INVOCATION.get(getBacktrace());
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
else if (saslMechanism.equals(SASL_MECHANISM_GSSAPI))
{
@@ -3211,7 +3214,7 @@
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_CANNOT_CREATE_SASL_CLIENT.get(
getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -3229,7 +3232,7 @@
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_CANNOT_CREATE_INITIAL_CHALLENGE.
get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
}
@@ -3255,13 +3258,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_GSSAPI, getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_GSSAPI, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -3275,7 +3278,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -3283,7 +3286,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -3291,13 +3294,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(
getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -3305,7 +3308,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -3336,12 +3339,12 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
@@ -3350,7 +3353,7 @@
BindResponseProtocolOp bindResponse =
responseMessage.getBindResponseProtocolOp();
int resultCode = bindResponse.getResultCode();
- if (resultCode == LDAPResultCode.SUCCESS)
+ if (resultCode == ReturnCode.SUCCESS.get())
{
// We should be done after this, but we still need to look for and
// handle the server SASL credentials.
@@ -3367,7 +3370,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_GSSAPI_CANNOT_VALIDATE_SERVER_CREDS.
get(getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
}
@@ -3378,13 +3381,13 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_GSSAPI_UNEXPECTED_SUCCESS_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message);
}
break;
}
- else if (resultCode == LDAPResultCode.SASL_BIND_IN_PROGRESS)
+ else if (resultCode == ReturnCode.SASL_BIND_IN_PROGRESS.get())
{
// Read the response and process the server SASL credentials.
ByteString serverSASLCredentials =
@@ -3406,7 +3409,7 @@
{
LocalizableMessage message = ERR_LDAPAUTH_GSSAPI_CANNOT_VALIDATE_SERVER_CREDS.
get(getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
@@ -3428,14 +3431,14 @@
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_GSSAPI, getExceptionMessage(ioe));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message, ioe);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_SEND_SASL_BIND.get(
SASL_MECHANISM_GSSAPI, getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -3448,7 +3451,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -3458,27 +3461,27 @@
ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE
.get(getExceptionMessage(ae));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_DECODING_ERROR, message, ae);
+ ReturnCode.CLIENT_SIDE_DECODING_ERROR, message, ae);
}
catch (IOException ioe)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(
getExceptionMessage(ioe));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(
getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
{
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_BIND_RESPONSE.get(
getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR,
message, e);
}
@@ -3512,12 +3515,12 @@
else
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_EXTENDED_RESPONSE.get(extendedResponse);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
default:
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
}
else
@@ -3535,7 +3538,7 @@
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RUN_INVOCATION.get(
saslMechanism, getBacktrace());
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
@@ -3632,14 +3635,14 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_SEND_WHOAMI_REQUEST.get(getExceptionMessage(ioe));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message, ioe);
}
catch (Exception e)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_SEND_WHOAMI_REQUEST.get(getExceptionMessage(e));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_ENCODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_ENCODING_ERROR,
message, e);
}
@@ -3653,7 +3656,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CONNECTION_CLOSED_WITHOUT_BIND_RESPONSE.get();
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
message);
}
}
@@ -3661,7 +3664,7 @@
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(getExceptionMessage(ae));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, ae);
}
catch (IOException ioe)
@@ -3669,13 +3672,13 @@
LocalizableMessage message = ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(
getExceptionMessage(ioe));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
+ ReturnCode.CLIENT_SIDE_SERVER_DOWN, message, ioe);
}
catch (LDAPException le)
{
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(getExceptionMessage(le));
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_DECODING_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_DECODING_ERROR,
message, le);
}
catch (Exception e)
@@ -3683,7 +3686,7 @@
LocalizableMessage message =
ERR_LDAPAUTH_CANNOT_READ_WHOAMI_RESPONSE.get(getExceptionMessage(e));
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
+ ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message, e);
}
@@ -3691,7 +3694,7 @@
if (responseMessage.getProtocolOpType() != OP_TYPE_EXTENDED_RESPONSE)
{
LocalizableMessage message = ERR_LDAPAUTH_UNEXPECTED_RESPONSE.get(responseMessage.getProtocolOp());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_LOCAL_ERROR, message);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_LOCAL_ERROR, message);
}
@@ -3713,7 +3716,7 @@
// response and the value would be the authorization ID. However, first
// check that it was successful. If it was not, then fail.
int resultCode = extendedResponse.getResultCode();
- if (resultCode != LDAPResultCode.SUCCESS)
+ if (resultCode != ReturnCode.SUCCESS.get())
{
LocalizableMessage message = ERR_LDAPAUTH_WHOAMI_FAILED.get();
throw new LDAPException(resultCode, extendedResponse.getErrorMessage(),
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
index 70495fe..4f3c73b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/LDAPConnection.java
@@ -54,6 +54,7 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.types.LDAPException;
+import com.forgerock.opendj.cli.ClientException;
import static org.opends.messages.CoreMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
@@ -453,7 +454,7 @@
} catch(ClientException ce)
{
logger.traceException(ce);
- throw new LDAPConnectionException(ce.getMessageObject(), ce.getExitCode(),
+ throw new LDAPConnectionException(ce.getMessageObject(), ce.getReturnCode(),
null, ce);
} catch (LDAPException le) {
throw new LDAPConnectionException(le.getMessageObject(),
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/ManageTasks.java b/opendj3-server-dev/src/server/org/opends/server/tools/ManageTasks.java
index 5917806..7f5f26a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/ManageTasks.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/ManageTasks.java
@@ -48,7 +48,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.StringArgument;
import org.opends.server.util.args.LDAPConnectionArgumentParser;
@@ -532,7 +532,7 @@
* {@inheritDoc}
*/
@Override
- public MenuResult<Void> invoke(ConsoleApplication app) throws CLIException {
+ public MenuResult<Void> invoke(ConsoleApplication app) throws ClientException {
return invoke((ManageTasks)app);
}
@@ -541,10 +541,10 @@
*
* @param app this console application
* @return MessageResult result of task
- * @throws CLIException if there is a problem
+ * @throws ClientException if there is a problem
*/
protected abstract MenuResult<Void> invoke(ManageTasks app)
- throws CLIException;
+ throws ClientException;
}
@@ -571,7 +571,7 @@
*/
@Override
public MenuResult<TaskEntry> invoke(ConsoleApplication app)
- throws CLIException
+ throws ClientException
{
return invoke((ManageTasks)app);
}
@@ -580,7 +580,7 @@
* {@inheritDoc}
*/
protected abstract MenuResult<TaskEntry> invoke(ManageTasks app)
- throws CLIException;
+ throws ClientException;
}
@@ -591,7 +591,7 @@
@Override
public MenuResult<Void> invoke(ManageTasks app)
- throws CLIException
+ throws ClientException
{
// Since the summary table is reprinted every time the
// user enters the top level this task just returns
@@ -620,7 +620,7 @@
* {@inheritDoc}
*/
@Override
- public MenuResult<Void> invoke(ManageTasks app) throws CLIException {
+ public MenuResult<Void> invoke(ManageTasks app) throws ClientException {
MenuResult<TaskEntry> res = new PrintTaskInfo(taskId).invoke(app);
TaskEntry taskEntry = res.getValue();
if (taskEntry != null) {
@@ -688,7 +688,7 @@
*/
@Override
public MenuResult<TaskEntry> invoke(ManageTasks app)
- throws CLIException
+ throws ClientException
{
LocalizableMessage m;
TaskEntry taskEntry;
@@ -881,7 +881,7 @@
*/
@Override
protected MenuResult<TaskEntry> invoke(ManageTasks app)
- throws CLIException
+ throws ClientException
{
TaskEntry taskEntry = null;
try {
@@ -942,7 +942,7 @@
*/
@Override
public MenuResult<Void> invoke(ManageTasks app)
- throws CLIException
+ throws ClientException
{
if (taskIds != null && taskIds.size() > 0) {
if (cancelableIndices != null && cancelableIndices.size() > 0) {
@@ -1015,7 +1015,7 @@
*/
@Override
public MenuResult<TaskEntry> invoke(ManageTasks app)
- throws CLIException
+ throws ClientException
{
try {
TaskEntry entry = app.getTaskClient().getTaskEntry(taskId);
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java b/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
index 15fe93f..c3964a6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/RestoreDB.java
@@ -59,7 +59,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.StringArgument;
import org.opends.server.util.args.LDAPConnectionArgumentParser;
@@ -246,7 +246,7 @@
err.println(argParser.getUsage());
return 1;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
// No need to display the usage since the problem comes with a provided
// value.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
index 748787a..4c2d579 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ArgumentExceptionFactory.java
@@ -41,9 +41,12 @@
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.MissingMandatoryPropertiesException;
import org.opends.server.admin.client.OperationRejectedException;
+
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TextTablePrinter;
@@ -57,16 +60,16 @@
public final class ArgumentExceptionFactory {
/**
- * Creates a CLI exception from an illegal managed object name
+ * Creates a ClientException exception from an illegal managed object name
* exception.
*
* @param e
* The illegal managed object name exception.
* @param d
* The managed object definition.
- * @return Returns a CLI exception.
+ * @return Returns a ClientException exception.
*/
- public static CLIException adaptIllegalManagedObjectNameException(
+ public static ClientException adaptIllegalManagedObjectNameException(
IllegalManagedObjectNameException e,
AbstractManagedObjectDefinition<?, ?> d) {
String illegalName = e.getIllegalName();
@@ -75,11 +78,11 @@
if (illegalName.length() == 0) {
LocalizableMessage message =
ERR_DSCFG_ERROR_ILLEGAL_NAME_EMPTY.get(d.getUserFriendlyPluralName());
- return new CLIException(message);
+ return new ClientException(ReturnCode.ERROR_USER_DATA, message);
} else if (illegalName.trim().length() == 0) {
LocalizableMessage message =
ERR_DSCFG_ERROR_ILLEGAL_NAME_BLANK.get(d.getUserFriendlyPluralName());
- return new CLIException(message);
+ return new ClientException(ReturnCode.ERROR_USER_DATA, message);
} else if (pd != null) {
try {
pd.decodeValue(illegalName);
@@ -90,13 +93,13 @@
LocalizableMessage message = ERR_DSCFG_ERROR_ILLEGAL_NAME_SYNTAX.get(
illegalName, d.getUserFriendlyName(), syntax);
- return new CLIException(message);
+ return new ClientException(ReturnCode.ERROR_USER_DATA, message);
}
}
LocalizableMessage message = ERR_DSCFG_ERROR_ILLEGAL_NAME_UNKNOWN.get(
illegalName, d.getUserFriendlyName());
- return new CLIException(message);
+ return new ClientException(ReturnCode.ERROR_USER_DATA, message);
}
@@ -640,13 +643,13 @@
* The definition of the managed object that was retrieved.
*
* @param subcommandName the sub-command name.
- * @return Returns a CLI exception.
+ * @return Returns a Client exception.
*/
- public static CLIException wrongManagedObjectType(RelationDefinition<?, ?> r,
+ public static ClientException wrongManagedObjectType(RelationDefinition<?, ?> r,
ManagedObjectDefinition<?, ?> d, String subcommandName) {
LocalizableMessage msg = ERR_DSCFG_ERROR_TYPE_UNRECOGNIZED_FOR_SUBCOMMAND.get(
d.getUserFriendlyName(), subcommandName);
- return new CLIException(msg);
+ return new ClientException(ReturnCode.ERROR_USER_DATA, msg);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
index fa7e740..1cfbb37 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/CreateSubCommandHandler.java
@@ -77,15 +77,16 @@
import org.opends.server.admin.client.OperationRejectedException;
import org.opends.server.admin.condition.Condition;
import org.opends.server.admin.condition.ContainsCondition;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
import org.opends.server.tools.ToolConstants;
+
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.HelpCallback;
import org.opends.server.util.cli.MenuBuilder;
@@ -473,15 +474,12 @@
* @throws ClientException
* If an unrecoverable client exception occurred whilst
* interacting with the server.
- * @throws CLIException
- * If an error occurred whilst interacting with the
- * console.
*/
public static <C extends ConfigurationClient, S extends Configuration>
MenuResult<String> createManagedObject(
ConsoleApplication app, ManagementContext context,
ManagedObject<?> parent, InstantiableRelationDefinition<C, S> rd)
- throws ClientException, CLIException {
+ throws ClientException {
return createManagedObject(app, context, parent, rd, null);
}
@@ -512,7 +510,7 @@
* @throws ClientException
* If an unrecoverable client exception occurred whilst
* interacting with the server.
- * @throws CLIException
+ * @throws ClientException
* If an error occurred whilst interacting with the
* console.
*/
@@ -521,7 +519,7 @@
ConsoleApplication app, ManagementContext context,
ManagedObject<?> parent, InstantiableRelationDefinition<C, S> rd,
SubCommandHandler handler)
- throws ClientException, CLIException {
+ throws ClientException {
AbstractManagedObjectDefinition<C, S> d = rd.getChildDefinition();
// First determine what type of component the user wants to create.
@@ -562,9 +560,9 @@
// Check that any referenced components are enabled if
// required.
private static MenuResult<Void> checkReferences(ConsoleApplication app,
- ManagementContext context, ManagedObject<?> mo,
- SubCommandHandler handler) throws ClientException,
- CLIException {
+ ManagementContext context, ManagedObject<?> mo, SubCommandHandler handler)
+ throws ClientException, ClientException
+ {
ManagedObjectDefinition<?, ?> d = mo.getManagedObjectDefinition();
LocalizableMessage ufn = d.getUserFriendlyName();
@@ -590,16 +588,16 @@
ref = context.getManagedObject(path);
} catch (DefinitionDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(rufn, rufn, rufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
// FIXME: should not abort here. Instead, display the
// errors (if verbose) and apply the changes to the
// partial managed object.
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(rufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(rufn);
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
Condition condition = apd.getTargetIsEnabledCondition();
@@ -637,7 +635,7 @@
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(ufn);
throw new ClientException(
- LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (OperationRejectedException e) {
// Give the user the chance to fix the problems.
app.println();
@@ -697,10 +695,10 @@
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
}
return MenuResult.success();
@@ -711,8 +709,7 @@
// Commit a new managed object's configuration.
private static MenuResult<Void> commitManagedObject(ConsoleApplication app,
ManagementContext context, ManagedObject<?> mo, SubCommandHandler handler)
- throws ClientException,
- CLIException {
+ throws ClientException {
ManagedObjectDefinition<?, ?> d = mo.getManagedObjectDefinition();
LocalizableMessage ufn = d.getUserFriendlyName();
@@ -792,16 +789,16 @@
return MenuResult.cancel();
}
} else {
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, e
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e
.getMessageObject(), e);
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (OperationRejectedException e) {
if (app.isInteractive()) {
// If interactive, give the user the chance to fix the
@@ -813,7 +810,7 @@
return MenuResult.cancel();
}
} else {
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, e
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e
.getMessageObject(), e);
}
} catch (CommunicationException e) {
@@ -823,7 +820,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
}
} catch (ManagedObjectAlreadyExistsException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_MOAEE.get(ufn);
@@ -832,7 +829,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.ENTRY_ALREADY_EXISTS, msg);
+ throw new ClientException(ReturnCode.ENTRY_ALREADY_EXISTS, msg);
}
}
}
@@ -846,12 +843,12 @@
ConsoleApplication app, final ManagedObject<?> parent,
final InstantiableRelationDefinition<C, S> irelation,
final ManagedObjectDefinition<? extends C, ? extends S> d,
- final List<PropertyException> exceptions) throws CLIException {
+ final List<PropertyException> exceptions) throws ClientException {
ValidationCallback<ManagedObject<? extends C>> validator =
new ValidationCallback<ManagedObject<? extends C>>() {
public ManagedObject<? extends C> validate(ConsoleApplication app,
- String input) throws CLIException {
+ String input) throws ClientException {
ManagedObject<? extends C> child;
// First attempt to create the child, this will guarantee that
@@ -859,7 +856,7 @@
try {
child = parent.createChild(irelation, d, input, exceptions);
} catch (IllegalManagedObjectNameException e) {
- CLIException ae = ArgumentExceptionFactory
+ ClientException ae = ArgumentExceptionFactory
.adaptIllegalManagedObjectNameException(e, d);
app.println();
app.println(ae.getMessageObject());
@@ -875,15 +872,15 @@
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(irelation
.getUserFriendlyName());
- throw new CLIException(msg);
+ throw new ClientException(ReturnCode.ERROR_USER_DATA, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(irelation
.getUserFriendlyName());
- throw new CLIException(msg);
+ throw new ClientException(ReturnCode.TODO, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(irelation
.getUserFriendlyName(), e.getMessage());
- throw new CLIException(msg);
+ throw new ClientException(ReturnCode.TODO, msg);
} catch (DefinitionDecodingException e) {
// Do nothing.
} catch (ManagedObjectDecodingException e) {
@@ -949,7 +946,7 @@
MenuResult<ManagedObjectDefinition<? extends C, ? extends S>>
getTypeInteractively(ConsoleApplication app,
AbstractManagedObjectDefinition<C, S> d,
- Set<String> prohibitedTypes) throws CLIException {
+ Set<String> prohibitedTypes) throws ClientException {
// First get the list of available of sub-types.
List<ManagedObjectDefinition<? extends C, ? extends S>> filteredTypes =
new LinkedList<ManagedObjectDefinition<? extends C,? extends S>>(
@@ -1153,7 +1150,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
LocalizableMessage ufn = relation.getUserFriendlyName();
// Get the naming argument values.
@@ -1173,22 +1170,22 @@
result = getManagedObject(app, context, path, names);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e
.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(pufn);
@@ -1197,7 +1194,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
}
@@ -1231,19 +1228,19 @@
catch (AuthorizationException e)
{
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
}
catch (ConcurrentModificationException e)
{
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
}
catch (CommunicationException e)
{
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e
.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
}
} else {
// No prohibited types.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
index b3dafed..bf693e9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -67,7 +67,6 @@
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.MissingMandatoryPropertiesException;
import org.opends.server.admin.client.OperationRejectedException;
-import org.opends.server.tools.ClientException;
import org.opends.server.types.InitializationException;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.EmbeddedUtils;
@@ -79,7 +78,7 @@
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
import com.forgerock.opendj.cli.ArgumentGroup;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.cli.CommandBuilder;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.Menu;
@@ -123,7 +122,7 @@
*/
@Override
public MenuResult<Integer> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
try {
MenuResult<Integer> result = handler.run(app, factory);
@@ -145,7 +144,7 @@
return MenuResult.success(1);
} catch (ClientException e) {
app.println(e.getMessageObject());
- return MenuResult.success(e.getExitCode());
+ return MenuResult.success(e.getReturnCode());
}
}
}
@@ -253,7 +252,7 @@
*/
@Override
public final MenuResult<Integer> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
try {
app.println();
app.println();
@@ -265,7 +264,7 @@
}
return result;
- } catch (CLIException e) {
+ } catch (ClientException e) {
app.println(e.getMessageObject());
return MenuResult.success(1);
}
@@ -967,7 +966,7 @@
} else {
return result.getValue();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
app.println(e.getMessageObject());
return 1;
}
@@ -994,9 +993,6 @@
} catch (ArgumentException e) {
println(e.getMessageObject());
return 1;
- } catch (CLIException e) {
- println(e.getMessageObject());
- return 1;
} catch (ClientException e) {
Throwable cause = e.getCause();
if (cause instanceof ManagedObjectDecodingException) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
index 8fb3574..da0b1a5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DeleteSubCommandHandler.java
@@ -49,14 +49,15 @@
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.client.OperationRejectedException;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
+
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuResult;
import org.opends.server.util.table.TableBuilder;
@@ -225,7 +226,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
// Get the naming argument values.
List<String> names = getNamingArgValues(app, namingArgs);
@@ -241,21 +242,21 @@
result = getManagedObject(app, context, path, names);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (ManagedObjectNotFoundException e) {
// Ignore the error if the deletion is being forced.
if (!forceArgument.isPresent()) {
@@ -266,7 +267,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
} else {
return MenuResult.success(0);
@@ -351,7 +352,7 @@
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (OperationRejectedException e) {
LocalizableMessage msg;
if (e.getMessages().size() == 1) {
@@ -378,21 +379,21 @@
builder.print(printer);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION,
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION,
msg, e);
}
} catch (ManagedObjectNotFoundException e) {
// Ignore the error if the deletion is being forced.
if (!forceArgument.isPresent()) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_MONFE.get(ufn);
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_DELETE_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
}
// Add the naming arguments if they were provided.
@@ -414,7 +415,7 @@
// Confirm deletion.
- private boolean confirmDeletion(ConsoleApplication app) throws CLIException {
+ private boolean confirmDeletion(ConsoleApplication app) throws ClientException {
if (app.isInteractive()) {
LocalizableMessage prompt = INFO_DSCFG_CONFIRM_DELETE.get(relation
.getUserFriendlyName());
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/GetPropSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/GetPropSubCommandHandler.java
index d06d18c..ffe9609 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/GetPropSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/GetPropSubCommandHandler.java
@@ -61,14 +61,15 @@
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
import org.opends.server.tools.ToolConstants;
+
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuResult;
import org.opends.server.util.table.TableBuilder;
@@ -235,7 +236,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
// Get the property names.
Set<String> propertyNames = getPropertyNames();
PropertyValuePrinter valuePrinter = new PropertyValuePrinter(getSizeUnit(),
@@ -260,22 +261,22 @@
result = getManagedObject(app, context, path, names);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(ufn);
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
if (result.isQuit()) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
index c405746..dec969c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/HelpSubCommandHandler.java
@@ -64,13 +64,12 @@
import org.opends.server.admin.Tag;
import org.opends.server.admin.UndefinedDefaultBehaviorProvider;
import org.opends.server.admin.PropertyException;
-import org.opends.server.tools.ClientException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuResult;
import org.opends.server.util.cli.OutputStreamConsoleApplication;
@@ -817,7 +816,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
String categoryName = categoryArgument.getValue();
String typeName = typeArgument.getValue();
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
index 06fb35b..f492a6a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/InternalManagementContextFactory.java
@@ -29,7 +29,7 @@
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.tools.ClientException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
import org.opends.server.util.cli.CommandBuilder;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
index 6b752ec..d29f210 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/LDAPManagementContextFactory.java
@@ -40,8 +40,9 @@
import org.opends.server.admin.client.ldap.LDAPConnection;
import org.opends.server.admin.client.ldap.LDAPManagementContext;
import org.opends.server.config.ConfigException;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
+
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.tools.JavaPropertiesTool.ErrorReturnCode;
import org.opends.server.tools.ToolConstants;
import org.opends.server.util.cli.CommandBuilder;
@@ -50,6 +51,7 @@
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
import java.util.LinkedHashSet;
@@ -221,19 +223,19 @@
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_NOT_TRUSTED.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
if (e.getRootCause() instanceof SSLException) {
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_WRONG_PORT.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
}
@@ -284,13 +286,13 @@
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
}
@@ -306,21 +308,21 @@
{
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_SIMPLE_BIND_NOT_SUPPORTED
.get();
- throw new ClientException(LDAPResultCode.AUTH_METHOD_NOT_SUPPORTED,
+ throw new ClientException(ReturnCode.AUTH_METHOD_NOT_SUPPORTED,
message);
}
catch (AuthenticationException e)
{
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_SIMPLE_BIND_FAILED
.get(bindDN);
- throw new ClientException(LDAPResultCode.INVALID_CREDENTIALS,
+ throw new ClientException(ReturnCode.INVALID_CREDENTIALS,
message);
}
catch (CommunicationException e)
{
LocalizableMessage message = ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(
hostName, portNumber);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_CONNECT_ERROR,
message);
}
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
index 6e2560f..24c5759 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ListSubCommandHandler.java
@@ -53,14 +53,15 @@
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
import org.opends.server.tools.ToolConstants;
+
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuResult;
import org.opends.server.util.table.TableBuilder;
@@ -211,7 +212,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
// Get the property names.
Set<String> propertyNames = getPropertyNames();
@@ -253,22 +254,22 @@
result = getManagedObject(app, context, path, names);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (DefinitionDecodingException e) {
ufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
ufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN, msg);
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (ManagedObjectNotFoundException e) {
ufn = path.getManagedObjectDefinition().getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MONFE.get(ufn);
@@ -277,7 +278,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
}
@@ -305,22 +306,22 @@
// FIXME: just output this as a warnings (incl. the name) but
// continue.
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
// FIXME: just output this as a warnings (incl. the name) but
// continue.
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
msg);
}
} else if (relation instanceof SetRelationDefinition) {
@@ -338,22 +339,22 @@
// FIXME: just output this as a warnings (incl. the name) but
// continue.
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
// FIXME: just output this as a warnings (incl. the name) but
// continue.
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
msg);
}
} else if (relation instanceof OptionalRelationDefinition) {
@@ -371,29 +372,29 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
msg);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_LIST_MONFE.get(ufn);
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
index 3153f4a..e9bf272 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/ManagementContextFactory.java
@@ -29,7 +29,7 @@
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.tools.ClientException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
import org.opends.server.util.cli.CommandBuilder;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
index 73e776f..2b439cf 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
@@ -69,10 +69,11 @@
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
import org.forgerock.util.Reject;
-import com.forgerock.opendj.cli.CLIException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.util.cli.HelpCallback;
import org.opends.server.util.cli.Menu;
import org.opends.server.util.cli.MenuBuilder;
@@ -114,7 +115,7 @@
* {@inheritDoc}
*/
public MenuResult<String> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
try {
// First get the parent managed object.
InstantiableRelationDefinition<?, ?> rd = pd.getRelationDefinition();
@@ -126,21 +127,21 @@
parent = context.getManagedObject(path);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition()
.getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_DDE.get(pufn, pufn, pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition()
.getUserFriendlyName();
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_PARENT_MODE.get(pufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_CREATE_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_SERVER_DOWN,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_SERVER_DOWN,
msg);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage pufn = path.getManagedObjectDefinition()
@@ -151,7 +152,7 @@
app.printVerboseMessage(msg);
return MenuResult.cancel();
} else {
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
}
@@ -421,7 +422,7 @@
MenuCallback<Void> {
// Any exception that was caught during processing.
- private CLIException e = null;
+ private ClientException e = null;
// The managed object being edited.
private final ManagedObject<?> mo;
@@ -444,7 +445,7 @@
* {@inheritDoc}
*/
public MenuResult<Void> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
displayPropertyHeader(app, pd);
MenuResult<Void> result = pd.accept(this, null);
@@ -484,13 +485,13 @@
try {
values.addAll(Arrays.asList(context.listManagedObjects(path, rd)));
} catch (AuthorizationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
} catch (ManagedObjectNotFoundException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.cancel();
} catch (CommunicationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
}
@@ -528,7 +529,7 @@
oldValues);
return MenuResult.success();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return MenuResult.cancel();
}
@@ -577,7 +578,7 @@
oldValues);
return MenuResult.success();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return MenuResult.cancel();
}
@@ -634,7 +635,7 @@
registerModification(d, new TreeSet<E>(newValues), oldValues);
return MenuResult.success();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return MenuResult.cancel();
}
@@ -660,7 +661,7 @@
isLastChoiceReset = false;
registerModification(d, values, oldValues);
return MenuResult.success();
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return MenuResult.cancel();
}
@@ -678,7 +679,7 @@
implements MenuCallback<Boolean> {
// Any exception that was caught during processing.
- private CLIException e = null;
+ private ClientException e = null;
// The managed object being edited.
private final ManagedObject<?> mo;
@@ -703,7 +704,7 @@
* {@inheritDoc}
*/
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
displayPropertyHeader(app, pd);
MenuResult<Boolean> result = pd.accept(this, null);
@@ -753,13 +754,13 @@
try {
values.addAll(Arrays.asList(context.listManagedObjects(path, rd)));
} catch (AuthorizationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
} catch (ManagedObjectNotFoundException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.cancel();
} catch (CommunicationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
}
@@ -770,7 +771,7 @@
addCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuBuilder<String> builder = new MenuBuilder<String>(app);
builder.setPrompt(INFO_EDITOR_PROMPT_SELECT_COMPONENTS_ADD
@@ -832,7 +833,7 @@
MenuCallback<Boolean> removeCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuBuilder<String> builder = new MenuBuilder<String>(app);
builder.setPrompt(INFO_EDITOR_PROMPT_SELECT_COMPONENTS_REMOVE
@@ -923,7 +924,7 @@
addCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuBuilder<T> builder = new MenuBuilder<T>(app);
builder.setPrompt(INFO_EDITOR_PROMPT_SELECT_VALUES_ADD.get());
@@ -979,7 +980,7 @@
MenuCallback<Boolean> removeCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuBuilder<T> builder = new MenuBuilder<T>(app);
builder.setPrompt(INFO_EDITOR_PROMPT_SELECT_VALUES_REMOVE.get());
@@ -1066,7 +1067,7 @@
MenuCallback<Boolean> addCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
app.println();
SortedSet<T> previousValues = new TreeSet<T>(currentValues);
readPropertyValues(app, mo.getManagedObjectDefinition(), d,
@@ -1083,7 +1084,7 @@
MenuCallback<Boolean> removeCallback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuBuilder<T> builder = new MenuBuilder<T>(app);
builder.setPrompt(INFO_EDITOR_PROMPT_SELECT_VALUES_REMOVE.get());
@@ -1341,7 +1342,7 @@
MenuCallback<Boolean> callback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
isLastChoiceReset = false;
currentValues.clear();
app.println();
@@ -1360,7 +1361,7 @@
MenuCallback<Boolean> callback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
currentValues.clear();
currentValues.addAll(defaultValues);
isLastChoiceReset = true;
@@ -1379,7 +1380,7 @@
MenuCallback<Boolean> callback = new MenuCallback<Boolean>() {
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
currentValues.clear();
currentValues.addAll(oldValues);
isLastChoiceReset = false;
@@ -1403,7 +1404,7 @@
try {
app.println();
result = menu.run();
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return null;
}
@@ -1480,7 +1481,7 @@
MenuCallback<Boolean> {
// Any exception that was caught during processing.
- private CLIException e = null;
+ private ClientException e = null;
// The managed object being edited.
private final ManagedObject<?> mo;
@@ -1503,7 +1504,7 @@
* {@inheritDoc}
*/
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
MenuResult<Boolean> result = pd.accept(this, null);
if (e != null) {
throw e;
@@ -1554,7 +1555,7 @@
boolean result;
try {
result = app.confirmAction(INFO_EDITOR_PROMPT_READ_ONLY.get(), false);
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return null;
}
@@ -1581,7 +1582,7 @@
implements MenuCallback<Boolean> {
// Any exception that was caught during processing.
- private CLIException e = null;
+ private ClientException e = null;
// The managed object being edited.
private final ManagedObject<?> mo;
@@ -1606,7 +1607,7 @@
* {@inheritDoc}
*/
public MenuResult<Boolean> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
displayPropertyHeader(app, pd);
MenuResult<Boolean> result = pd.accept(this, null);
@@ -1651,13 +1652,13 @@
try {
values.addAll(Arrays.asList(context.listManagedObjects(path, rd)));
} catch (AuthorizationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
} catch (ManagedObjectNotFoundException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.cancel();
} catch (CommunicationException e) {
- this.e = new CLIException(e.getMessageObject());
+ this.e = new ClientException(ReturnCode.TODO, e.getMessageObject());
return MenuResult.quit();
}
@@ -1836,7 +1837,7 @@
new MenuCallback<T>() {
public MenuResult<T> invoke(ConsoleApplication app)
- throws CLIException {
+ throws ClientException {
app.println();
Set<T> values = readPropertyValues(app, mo
.getManagedObjectDefinition(), d);
@@ -1958,7 +1959,7 @@
try {
app.println();
result = menu.run();
- } catch (CLIException e) {
+ } catch (ClientException e) {
this.e = e;
return null;
}
@@ -2121,7 +2122,7 @@
// Read new values for a property.
private static <T> SortedSet<T> readPropertyValues(ConsoleApplication app,
ManagedObjectDefinition<?, ?> d, PropertyDefinition<T> pd)
- throws CLIException {
+ throws ClientException {
SortedSet<T> values = new TreeSet<T>(pd);
readPropertyValues(app, d, pd, values);
return values;
@@ -2132,7 +2133,7 @@
// Add values to a property.
private static <T> void readPropertyValues(ConsoleApplication app,
ManagedObjectDefinition<?, ?> d, PropertyDefinition<T> pd,
- SortedSet<T> values) throws CLIException {
+ SortedSet<T> values) throws ClientException {
// Make sure there is at least one value if mandatory and empty.
if (values.isEmpty()) {
while (true) {
@@ -2260,13 +2261,13 @@
* {@code MenuResult.cancel()} if the user to chose to
* cancel any changes, or {@code MenuResult.quit()} if the
* user chose to quit the application.
- * @throws CLIException
+ * @throws ClientException
* If the user input could not be retrieved for some
* reason.
*/
public MenuResult<Void> edit(ManagedObject<?> mo,
Collection<PropertyDefinition<?>> c, boolean isCreate)
- throws CLIException {
+ throws ClientException {
// Get values for this missing mandatory property.
for (PropertyDefinition<?> pd : c) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
index a24c02a..26dda2d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SetPropSubCommandHandler.java
@@ -64,14 +64,15 @@
import org.opends.server.admin.client.OperationRejectedException;
import org.opends.server.admin.condition.Condition;
import org.opends.server.admin.condition.ContainsCondition;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
+
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.CommandBuilder;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuResult;
@@ -250,14 +251,14 @@
* @throws ClientException
* If an unrecoverable client exception occurred whilst
* interacting with the server.
- * @throws CLIException
+ * @throws ClientException
* If an error occurred whilst interacting with the
* console.
*/
public static MenuResult<Void> modifyManagedObject(ConsoleApplication app,
- ManagementContext context, ManagedObject<?> mo,
- SubCommandHandler handler) throws ClientException,
- CLIException {
+ ManagementContext context, ManagedObject<?> mo, SubCommandHandler handler)
+ throws ClientException
+ {
ManagedObjectDefinition<?, ?> d = mo.getManagedObjectDefinition();
LocalizableMessage ufn = d.getUserFriendlyName();
@@ -342,16 +343,16 @@
return MenuResult.cancel();
}
} else {
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, e
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e
.getMessageObject(), e);
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS,
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS,
msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (OperationRejectedException e) {
if (app.isInteractive()) {
// If interactive, give the user the chance to fix the
@@ -363,12 +364,12 @@
return MenuResult.cancel();
}
} else {
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, e
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, e
.getMessageObject(), e);
}
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectAlreadyExistsException e) {
// Should never happen.
throw new IllegalStateException(e);
@@ -383,8 +384,8 @@
*/
private static MenuResult<Void> checkReferences(ConsoleApplication app,
ManagementContext context, ManagedObject<?> mo,
- SubCommandHandler handler) throws ClientException,
- CLIException {
+ SubCommandHandler handler) throws ClientException
+ {
ManagedObjectDefinition<?, ?> d = mo.getManagedObjectDefinition();
LocalizableMessage ufn = d.getUserFriendlyName();
@@ -410,16 +411,16 @@
ref = context.getManagedObject(path);
} catch (DefinitionDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(rufn, rufn, rufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
// FIXME: should not abort here. Instead, display the
// errors (if verbose) and apply the changes to the
// partial managed object.
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(rufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (ManagedObjectNotFoundException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MONFE.get(rufn);
- throw new ClientException(LDAPResultCode.NO_SUCH_OBJECT, msg);
+ throw new ClientException(ReturnCode.NO_SUCH_OBJECT, msg);
}
Condition condition = apd.getTargetIsEnabledCondition();
@@ -512,7 +513,7 @@
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CME.get(ufn);
throw new ClientException(
- LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (OperationRejectedException e) {
// Give the user the chance to fix the problems.
app.println();
@@ -572,10 +573,10 @@
}
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
}
return MenuResult.success();
@@ -693,7 +694,7 @@
@Override
public MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException {
+ ClientException {
// Get the naming argument values.
List<String> names = getNamingArgValues(app, namingArgs);
@@ -713,21 +714,21 @@
result = getManagedObject(app, context, path, names);
} catch (AuthorizationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_AUTHZ.get(ufn);
- throw new ClientException(LDAPResultCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
+ throw new ClientException(ReturnCode.INSUFFICIENT_ACCESS_RIGHTS, msg);
} catch (DefinitionDecodingException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_DDE.get(ufn, ufn, ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ManagedObjectDecodingException e) {
// FIXME: should not abort here. Instead, display the errors (if
// verbose) and apply the changes to the partial managed object.
LocalizableMessage msg = ERR_DSCFG_ERROR_GET_CHILD_MODE.get(ufn);
- throw new ClientException(LDAPResultCode.OTHER, msg, e);
+ throw new ClientException(ReturnCode.OTHER, msg, e);
} catch (CommunicationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CE.get(ufn, e.getMessage());
- throw new ClientException(LDAPResultCode.OTHER, msg);
+ throw new ClientException(ReturnCode.OTHER, msg);
} catch (ConcurrentModificationException e) {
LocalizableMessage msg = ERR_DSCFG_ERROR_MODIFY_CME.get(ufn);
- throw new ClientException(LDAPResultCode.CONSTRAINT_VIOLATION, msg);
+ throw new ClientException(ReturnCode.CONSTRAINT_VIOLATION, msg);
} catch (ManagedObjectNotFoundException e) {
String objName = names.get(names.size() - 1);
ArgumentException except = null;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
index bb73a60..459d4eb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -44,6 +44,7 @@
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
+
import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.admin.AbstractManagedObjectDefinition;
import org.opends.server.admin.Configuration;
@@ -71,14 +72,16 @@
import org.opends.server.admin.client.ManagedObject;
import org.opends.server.admin.client.ManagedObjectDecodingException;
import org.opends.server.admin.client.ManagementContext;
-import org.opends.server.tools.ClientException;
import org.opends.server.util.ServerConstants;
+
import com.forgerock.opendj.cli.Argument;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
+import com.forgerock.opendj.cli.ReturnCode;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommand;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
+
import org.opends.server.util.cli.CommandBuilder;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.Menu;
@@ -115,7 +118,7 @@
// Any CLI exception that was caught when attempting to find
// the managed object.
- private CLIException clie;
+ private ClientException clie;
private ConcurrentModificationException cme;
@@ -159,7 +162,7 @@
} else {
childName = sresult.getValue();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
clie = e;
result = MenuResult.quit();
return;
@@ -281,7 +284,7 @@
} else {
childName = sresult.getValue();
}
- } catch (CLIException e) {
+ } catch (ClientException e) {
clie = e;
result = MenuResult.quit();
return;
@@ -303,7 +306,7 @@
String typeUsage = getSubTypesUsage(d);
LocalizableMessage msg = ERR_DSCFG_ERROR_SUB_TYPE_UNRECOGNIZED.get(
name, r.getUserFriendlyName(), typeUsage);
- clie = new CLIException(msg);
+ clie = new ClientException(ReturnCode.TODO, msg);
result = MenuResult.quit();
return;
} else {
@@ -406,7 +409,7 @@
* object path, or {@link MenuResult#quit()}, or
* {@link MenuResult#cancel()}, if the sub-command was
* run interactively and the user chose to quit or cancel.
- * @throws CLIException
+ * @throws ClientException
* If one of the naming arguments referenced a managed
* object of the wrong type.
* @throws DefinitionDecodingException
@@ -431,7 +434,7 @@
*/
public MenuResult<ManagedObject<?>> find(ConsoleApplication app,
ManagementContext context, ManagedObjectPath<?, ?> path,
- List<String> args) throws CLIException, CommunicationException,
+ List<String> args) throws ClientException, CommunicationException,
AuthorizationException, ConcurrentModificationException,
DefinitionDecodingException, ManagedObjectDecodingException,
ManagedObjectNotFoundException {
@@ -846,12 +849,12 @@
* parsed successfully.
* @throws ClientException
* If the management context could not be created.
- * @throws CLIException
+ * @throws ClientException
* If a CLI exception occurred.
*/
public abstract MenuResult<Integer> run(ConsoleApplication app,
ManagementContextFactory factory) throws ArgumentException,
- ClientException, CLIException;
+ ClientException;
@@ -971,7 +974,7 @@
* @throws CommunicationException
* If the client cannot contact the server due to an
* underlying communication problem.
- * @throws CLIException
+ * @throws ClientException
* If one of the naming arguments referenced a managed
* object of the wrong type.
* @throws ClientException
@@ -979,11 +982,11 @@
*/
protected final MenuResult<ManagedObject<?>> getManagedObject(
ConsoleApplication app, ManagementContext context,
- ManagedObjectPath<?, ?> path, List<String> args) throws CLIException,
+ ManagedObjectPath<?, ?> path, List<String> args) throws ClientException,
AuthorizationException, DefinitionDecodingException,
ManagedObjectDecodingException, CommunicationException,
- ConcurrentModificationException, ManagedObjectNotFoundException,
- ClientException {
+ ConcurrentModificationException, ManagedObjectNotFoundException
+ {
ManagedObjectFinder finder = new ManagedObjectFinder();
return finder.find(app, context, path, args);
}
@@ -1140,7 +1143,7 @@
* @throws AuthorizationException
* If the children cannot be listed due to an authorization
* failure.
- * @throws CLIException
+ * @throws ClientException
* If the user input can be read from the console or if
* there are no children.
*/
@@ -1150,7 +1153,7 @@
RelationDefinition<C, S> r,
AbstractManagedObjectDefinition<? extends C, ? extends S> d)
throws AuthorizationException, ConcurrentModificationException,
- CommunicationException, CLIException {
+ CommunicationException, ClientException {
if (d == null) {
d = r.getChildDefinition();
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
index f0824f5..32c1ec2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -51,7 +51,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.ArgumentGroup;
import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
import com.forgerock.opendj.cli.StringArgument;
@@ -1915,7 +1915,7 @@
taskArgs.validateArgs();
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
addMessage(buf, ce.getMessageObject());
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index d93b039..79cb626 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -66,7 +66,6 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
-import org.opends.server.tools.ClientException;
import org.opends.server.tools.ToolConstants;
import org.opends.server.tools.tasks.TaskEntry;
import org.opends.server.tools.tasks.TaskScheduleInteraction;
@@ -84,7 +83,7 @@
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.ArgumentException;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.FileBasedArgument;
import com.forgerock.opendj.cli.IntegerArgument;
@@ -1426,7 +1425,7 @@
suffixes.add(dn);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
confirmationLimitReached = true;
@@ -1517,7 +1516,7 @@
INFO_REPLICATION_PURGE_HISTORICAL_LOCAL_PROMPT.get(),
true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -1620,7 +1619,7 @@
{
interaction.run();
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -1779,7 +1778,7 @@
cancelled = true;
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -1801,7 +1800,7 @@
INFO_REPLICATION_ENABLE_REPLICATION_SERVER1_PROMPT.get(),
true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -1857,7 +1856,7 @@
askConfirmation(INFO_REPLICATION_ENABLE_SECURE1_PROMPT.get(replicationPort1),
false, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -1877,7 +1876,7 @@
INFO_REPLICATION_ENABLE_REPLICATION_DOMAIN1_PROMPT.get(),
true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2069,7 +2068,7 @@
cancelled = true;
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2091,7 +2090,7 @@
INFO_REPLICATION_ENABLE_REPLICATION_SERVER2_PROMPT.get(),
true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2156,7 +2155,7 @@
secureReplication2 =
askConfirmation(INFO_REPLICATION_ENABLE_SECURE2_PROMPT.get(replicationPort2), false, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2177,7 +2176,7 @@
INFO_REPLICATION_ENABLE_REPLICATION_DOMAIN2_PROMPT.get(),
true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2388,7 +2387,7 @@
disableAll = askConfirmation(INFO_REPLICATION_PROMPT_DISABLE_ALL.get(),
disableAll, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2408,7 +2407,7 @@
disableReplicationServer,
logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2426,7 +2425,7 @@
false,
logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2457,7 +2456,7 @@
INFO_REPLICATION_DISABLE_ALL_SUFFIXES_DISABLE_REPLICATION_SERVER.get(
ConnectionUtils.getHostPort(ctx), repPort), true, logger));
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2489,7 +2488,7 @@
cancelled = !askConfirmation(INFO_REPLICATION_CONFIRM_DISABLE_ADS.get(
ADSContext.getAdministrationSuffixDN()), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2504,7 +2503,7 @@
cancelled = !askConfirmation(
INFO_REPLICATION_CONFIRM_DISABLE_SCHEMA.get(), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2524,7 +2523,7 @@
logger);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2637,7 +2636,7 @@
ADSContext.getAdministrationSuffixDN(), hostPortSource), true,
logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -2653,7 +2652,7 @@
INFO_REPLICATION_CONFIRM_INITIALIZE_ALL_GENERIC.get(
hostPortSource), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -3114,7 +3113,7 @@
ADSContext.getAdministrationSuffixDN(), hostPortDestination,
hostPortSource), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -3130,7 +3129,7 @@
INFO_REPLICATION_CONFIRM_INITIALIZE_GENERIC.get(
hostPortDestination, hostPortSource), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -3720,7 +3719,7 @@
get(Utils.getMessageFromCollection(exceptionMsgs,
Constants.LINE_SEPARATOR)), true, logger);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
cancelled = true;
@@ -4949,7 +4948,7 @@
suffixes.add(dn);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
confirmationLimitReached = true;
@@ -5130,7 +5129,7 @@
suffixes.add(dn);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
confirmationLimitReached = true;
@@ -5344,7 +5343,7 @@
true, logger);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
confirmationLimitReached = true;
@@ -5462,7 +5461,7 @@
suffixes.add(dn);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
confirmationLimitReached = true;
@@ -6413,7 +6412,7 @@
ReplicationCliReturnCode.USER_CANCELLED, null);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
throw new ReplicationCliException(
@@ -6499,7 +6498,7 @@
ReplicationCliReturnCode.USER_CANCELLED, null);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
throw new ReplicationCliException(
@@ -9320,7 +9319,7 @@
returnValue = SubcommandChoice.CANCEL;
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
returnValue = SubcommandChoice.CANCEL;
logger.warn(LocalizableMessage.raw("Error reading input: "+ce, ce));
@@ -10633,7 +10632,7 @@
ReplicationCliReturnCode.USER_CANCELLED, null);
}
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
println(ce.getMessageObject());
throw new ReplicationCliException(
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java b/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java
index 07e1c4c..f24af1f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCli.java
@@ -59,7 +59,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
import org.opends.server.config.ConfigException;
-import org.opends.server.tools.ClientException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.tools.ToolConstants;
import org.opends.server.tools.dsconfig.LDAPManagementContextFactory;
import org.opends.server.types.DN;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java b/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
index 47d20c5..a36c88d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskScheduleInteraction.java
@@ -44,7 +44,10 @@
import org.opends.server.backends.task.RecurringTask;
import org.opends.server.types.DirectoryException;
import org.opends.server.util.StaticUtils;
-import com.forgerock.opendj.cli.CLIException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.MenuBuilder;
import org.opends.server.util.cli.MenuResult;
@@ -120,9 +123,9 @@
/**
* Executes the interaction with the user.
- * @throws CLIException if there is an error prompting the user.
+ * @throws ClientException if there is an error prompting the user.
*/
- public void run() throws CLIException
+ public void run() throws ClientException
{
headerDisplayed = false;
@@ -179,7 +182,7 @@
this.formatter = formatter;
}
- private void runFailedDependencyAction() throws CLIException
+ private void runFailedDependencyAction() throws ClientException
{
if (args.dependencyArg.isPresent())
{
@@ -191,7 +194,7 @@
}
}
- private void askForFailedDependencyAction() throws CLIException
+ private void askForFailedDependencyAction() throws ClientException
{
checkHeaderDisplay();
@@ -217,12 +220,12 @@
}
else
{
- throw new CLIException(LocalizableMessage.EMPTY);
+ throw new ClientException(ReturnCode.TODO, LocalizableMessage.EMPTY);
}
}
- private void runDependency() throws CLIException
+ private void runDependency() throws ClientException
{
if (args.dependencyArg.isPresent())
{
@@ -234,7 +237,7 @@
}
}
- private void askForDependency() throws CLIException
+ private void askForDependency() throws ClientException
{
checkHeaderDisplay();
@@ -310,7 +313,7 @@
return taskIDDefined;
}
- private void runErrorNotification() throws CLIException
+ private void runErrorNotification() throws ClientException
{
if (args.errorNotificationArg.isPresent())
{
@@ -323,7 +326,7 @@
}
}
- private void askForErrorNotification() throws CLIException
+ private void askForErrorNotification() throws ClientException
{
List<String> addresses =
askForEmailNotification(INFO_HAS_ERROR_NOTIFICATION_PROMPT.get(),
@@ -332,7 +335,7 @@
}
private List<String> askForEmailNotification(LocalizableMessage hasNotificationPrompt,
- LocalizableMessage emailAddressPrompt) throws CLIException
+ LocalizableMessage emailAddressPrompt) throws ClientException
{
checkHeaderDisplay();
@@ -366,7 +369,7 @@
return addresses;
}
- private void runCompletionNotification() throws CLIException
+ private void runCompletionNotification() throws ClientException
{
if (args.completionNotificationArg.isPresent())
{
@@ -379,7 +382,7 @@
}
}
- private void askForCompletionNotification() throws CLIException
+ private void askForCompletionNotification() throws ClientException
{
List<String> addresses =
askForEmailNotification(INFO_HAS_COMPLETION_NOTIFICATION_PROMPT.get(),
@@ -387,7 +390,7 @@
uData.setNotifyUponCompletionEmailAddresses(addresses);
}
- private void runStartNowOrSchedule() throws CLIException
+ private void runStartNowOrSchedule() throws ClientException
{
if (args.startArg.isPresent())
{
@@ -406,7 +409,7 @@
}
}
- private void askToStartNowOrSchedule() throws CLIException
+ private void askToStartNowOrSchedule() throws ClientException
{
checkHeaderDisplay();
@@ -442,11 +445,11 @@
}
else
{
- throw new CLIException(LocalizableMessage.EMPTY);
+ throw new ClientException(ReturnCode.TODO, LocalizableMessage.EMPTY);
}
}
- private void askForStartDate() throws CLIException
+ private void askForStartDate() throws ClientException
{
checkHeaderDisplay();
@@ -473,7 +476,7 @@
uData.setStartDate(startDate);
}
- private void askForTaskSchedule() throws CLIException
+ private void askForTaskSchedule() throws ClientException
{
checkHeaderDisplay();
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java b/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java
index 4f814ba..8653362 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/tasks/TaskTool.java
@@ -31,7 +31,7 @@
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.StringArgument;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import static org.opends.server.util.StaticUtils.wrapText;
import static org.opends.server.util.StaticUtils.getExceptionMessage;
@@ -175,10 +175,10 @@
* been called.
*
* @throws ArgumentException if there is a problem with the arguments.
- * @throws CLIException if there is a problem with one of the values provided
+ * @throws ClientException if there is a problem with one of the values provided
* by the user.
*/
- protected void validateTaskArgs() throws ArgumentException, CLIException
+ protected void validateTaskArgs() throws ArgumentException, ClientException
{
if (processAsTask())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/AbstractUpgradeTask.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/AbstractUpgradeTask.java
index 7233439..34c4dc8 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/AbstractUpgradeTask.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/AbstractUpgradeTask.java
@@ -21,11 +21,11 @@
* CDDL HEADER END
*
*
- * Copyright 2013 ForgeRock AS
+ * Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.tools.upgrade;
-import org.opends.server.tools.ClientException;
+import com.forgerock.opendj.cli.ClientException;
/**
* Abstract upgrade task implementation.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java
index 350dd50..0a0f8d4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/Upgrade.java
@@ -46,7 +46,10 @@
import javax.security.auth.callback.ConfirmationCallback;
import org.opends.server.core.LockFileManager;
-import org.opends.server.tools.ClientException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.util.BuildVersion;
import org.opends.server.util.StaticUtils;
@@ -452,7 +455,7 @@
{
final LocalizableMessage message = INFO_UPGRADE_ABORTED_BY_USER.get();
context.notify(message, WARNING);
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
try
@@ -503,7 +506,7 @@
{
final LocalizableMessage message = ERR_UPGRADE_TASKS_FAIL.get(e.getMessage());
context.notify(message, ERROR_CALLBACK);
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
finally
{
@@ -576,7 +579,7 @@
{
final LocalizableMessage message = ERR_UPGRADE_REQUIRES_SERVER_OFFLINE.get();
context.notify(message, NOTICE_CALLBACK);
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
}
finally
@@ -605,7 +608,7 @@
final LocalizableMessage message =
ERR_UPGRADE_VERSION_UP_TO_DATE.get(context.getToVersion());
context.notify(message, NOTICE_CALLBACK);
- throw new ClientException(EXIT_CODE_SUCCESS, message);
+ throw new ClientException(ReturnCode.SUCCESS, message);
}
// The upgrade only supports version >= 2.4.5.
@@ -614,7 +617,7 @@
final LocalizableMessage message = INFO_UPGRADE_VERSION_IS_NOT_SUPPORTED.get(
UPGRADESUPPORTSVERSIONFROM, UPGRADESUPPORTSVERSIONFROM);
context.notify(message, NOTICE_CALLBACK);
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
}
@@ -648,7 +651,7 @@
{
final LocalizableMessage message = LocalizableMessage.raw(e.getMessage());
context.notify(message, ERROR_CALLBACK);
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
finally
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
index 8a16a96..6b426a6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeCli.java
@@ -49,14 +49,13 @@
import javax.security.auth.callback.UnsupportedCallbackException;
import org.opends.server.extensions.ConfigFileHandler;
-import org.opends.server.tools.ClientException;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
import com.forgerock.opendj.cli.ArgumentException;
import com.forgerock.opendj.cli.BooleanArgument;
import com.forgerock.opendj.cli.StringArgument;
import com.forgerock.opendj.cli.SubCommandArgumentParser;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.cli.ConsoleApplication;
/**
@@ -364,7 +363,7 @@
}
catch (ClientException ex)
{
- return ex.getExitCode();
+ return ex.getReturnCode();
}
catch (Exception ex)
{
@@ -496,7 +495,7 @@
readInput(LocalizableMessage.raw(prompt), defaultOption,
Style.SUBTITLE);
}
- catch (CLIException e)
+ catch (ClientException e)
{
logger.error(LocalizableMessage.raw(e.getMessage()));
break;
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeContext.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeContext.java
index 2bed0e8..52421a9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeContext.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeContext.java
@@ -29,7 +29,6 @@
import static org.opends.messages.ToolMessages.*;
-import static org.opends.server.tools.upgrade.Upgrade.EXIT_CODE_ERROR;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
@@ -37,7 +36,10 @@
import javax.security.auth.callback.TextOutputCallback;
import org.forgerock.i18n.LocalizableMessage;
-import org.opends.server.tools.ClientException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.types.InitializationException;
import org.opends.server.util.BuildVersion;
@@ -286,7 +288,7 @@
}
catch (final Exception e)
{
- throw new ClientException(EXIT_CODE_ERROR,
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED,
ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
}
}
@@ -313,7 +315,7 @@
}
catch (final Exception e)
{
- throw new ClientException(EXIT_CODE_ERROR,
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED,
ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
}
}
@@ -337,7 +339,7 @@
}
catch (final Exception e)
{
- throw new ClientException(EXIT_CODE_ERROR,
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED,
ERR_UPGRADE_DISPLAY_NOTIFICATION_ERROR.get(e.getMessage()));
}
}
@@ -367,7 +369,7 @@
}
catch (final Exception e)
{
- throw new ClientException(EXIT_CODE_ERROR,
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED,
ERR_UPGRADE_DISPLAY_CONFIRM_ERROR.get(e.getMessage()));
}
return confirmYNCallback.getSelectedIndex();
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeLog.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
index a6e3945..86f7649 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeLog.java
@@ -39,7 +39,9 @@
import java.util.logging.Logger;
import org.opends.messages.RuntimeMessages;
-import org.opends.server.tools.ClientException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_INVALID_LOG_FILE;
@@ -125,7 +127,7 @@
}
catch (FileNotFoundException e)
{
- throw new ClientException(1, ERR_UPGRADE_INVALID_LOG_FILE.get(e
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, ERR_UPGRADE_INVALID_LOG_FILE.get(e
.getMessage()));
}
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTask.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTask.java
index de5e654..a1c54a6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTask.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTask.java
@@ -21,12 +21,12 @@
* CDDL HEADER END
*
*
- * Copyright 2013 ForgeRock AS
+ * Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.tools.upgrade;
-import org.opends.server.tools.ClientException;
+import com.forgerock.opendj.cli.ClientException;
/**
* An upgrade task.
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
index a2daed2..c449d84 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -48,7 +48,10 @@
import javax.security.auth.callback.TextOutputCallback;
import org.forgerock.opendj.ldap.Filter;
-import org.opends.server.tools.ClientException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
+
import org.opends.server.tools.RebuildIndex;
import org.opends.server.util.BuildVersion;
import org.opends.server.util.ChangeOperationType;
@@ -665,7 +668,7 @@
{
final LocalizableMessage msg = ERR_UPGRADE_PERFORMING_POST_TASKS_FAIL.get();
context.notifyProgress(pnc.setProgress(-100));
- throw new ClientException(EXIT_CODE_ERROR, msg);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, msg);
}
}
else
@@ -872,7 +875,7 @@
logger.error(message);
if (!context.isIgnoreErrorsMode())
{
- throw new ClientException(EXIT_CODE_ERROR, message);
+ throw new ClientException(ReturnCode.ERROR_UNEXPECTED, message);
}
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/ConsoleApplication.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/ConsoleApplication.java
index 743c34f..857628c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/ConsoleApplication.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/ConsoleApplication.java
@@ -61,13 +61,13 @@
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.admin.ads.util.OpendsCertificateException;
import org.opends.quicksetup.util.Utils;
-import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.tools.ClientException;
import org.opends.server.types.NullOutputStream;
import org.opends.server.util.PasswordReader;
import org.opends.server.util.SetupUtils;
import org.opends.server.util.StaticUtils;
-import com.forgerock.opendj.cli.CLIException;
+
+import com.forgerock.opendj.cli.ClientException;
+import com.forgerock.opendj.cli.ReturnCode;
/**
@@ -221,12 +221,12 @@
* @return Returns <code>true</code> if the user wishes the action to be
* performed, or <code>false</code> if they refused, or if an
* exception occurred.
- * @throws CLIException
+ * @throws ClientException
* If the user's response could not be read from the console for
* some reason.
*/
public final boolean confirmAction(LocalizableMessage prompt, final boolean defaultValue)
- throws CLIException
+ throws ClientException
{
if (!isInteractive())
{
@@ -364,7 +364,7 @@
{
readLineOfInput(msg);
}
- catch (CLIException e)
+ catch (ClientException e)
{
// Ignore the exception - applications don't care.
}
@@ -603,10 +603,10 @@
* The prompt.
* @return Returns the line of input, or <code>null</code> if the end of input
* has been reached.
- * @throws CLIException
+ * @throws ClientException
* If the line of input could not be retrieved for some reason.
*/
- public final String readLineOfInput(LocalizableMessage prompt) throws CLIException
+ public final String readLineOfInput(LocalizableMessage prompt) throws ClientException
{
if (prompt != null)
{
@@ -618,7 +618,7 @@
String s = in.readLine();
if (s == null)
{
- throw CLIException
+ throw ClientException
.adaptInputException(new EOFException("End of input"));
}
else
@@ -628,7 +628,7 @@
}
catch (IOException e)
{
- throw CLIException.adaptInputException(e);
+ throw ClientException.adaptInputException(e);
}
}
@@ -642,12 +642,12 @@
* @param msgStyle
* The formatted style chosen.
* @return The user's input as a string.
- * @throws CLIException
+ * @throws ClientException
* If an Exception occurs during the process.
*/
public final String readInput(final LocalizableMessage prompt,
final String defaultValue, final Style msgStyle)
- throws CLIException
+ throws ClientException
{
String answer = null;
if (msgStyle == Style.TITLE)
@@ -664,7 +664,7 @@
}
catch (IOException e)
{
- throw CLIException.adaptInputException(e);
+ throw ClientException.adaptInputException(e);
}
if (msgStyle == Style.TITLE
@@ -698,12 +698,12 @@
* The default value to assume if the user presses ENTER without
* typing anything, or <CODE>null</CODE> if there should not be a
* default and the user must explicitly provide a value.
- * @throws CLIException
+ * @throws ClientException
* If the line of input could not be retrieved for some reason.
* @return The string value read from the user.
*/
public String readInput(LocalizableMessage prompt, String defaultValue)
- throws CLIException
+ throws ClientException
{
while (true)
{
@@ -754,7 +754,7 @@
{
s = readInput(prompt, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: " + ce, ce));
}
@@ -767,10 +767,10 @@
* @param prompt
* The password prompt.
* @return Returns the password.
- * @throws CLIException
+ * @throws ClientException
* If the password could not be retrieved for some reason.
*/
- public final String readPassword(LocalizableMessage prompt) throws CLIException
+ public final String readPassword(LocalizableMessage prompt) throws ClientException
{
err.print(wrapText(prompt + " ", MAX_LINE_WIDTH));
char[] pwChars;
@@ -780,7 +780,7 @@
}
catch (Exception e)
{
- throw CLIException.adaptInputException(e);
+ throw ClientException.adaptInputException(e);
}
return new String(pwChars);
}
@@ -803,7 +803,7 @@
{
pwd = readPassword(prompt);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: " + ce, ce));
}
@@ -818,17 +818,17 @@
* @param defaultValue
* The port default value.
* @return Returns the port.
- * @throws CLIException
+ * @throws ClientException
* If the port could not be retrieved for some reason.
*/
public final int readPort(LocalizableMessage prompt, final int defaultValue)
- throws CLIException
+ throws ClientException
{
ValidationCallback<Integer> callback = new ValidationCallback<Integer>()
{
@Override
public Integer validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -902,7 +902,7 @@
{
port = readPort(prompt, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
port = -1;
logger.warn(LocalizableMessage.raw("Error reading input: " + ce, ce));
@@ -924,11 +924,11 @@
* An input validator responsible for validating and decoding the
* user's response.
* @return Returns the decoded user's response.
- * @throws CLIException
+ * @throws ClientException
* If an unexpected error occurred which prevented validation.
*/
public final <T> T readValidatedInput(LocalizableMessage prompt,
- ValidationCallback<T> validator) throws CLIException
+ ValidationCallback<T> validator) throws ClientException
{
while (true)
{
@@ -956,12 +956,12 @@
* @param maxTries
* The maximum number of tries that we can make.
* @return Returns the decoded user's response.
- * @throws CLIException
+ * @throws ClientException
* If an unexpected error occurred which prevented validation or if
* the maximum number of tries was reached.
*/
public final <T> T readValidatedInput(LocalizableMessage prompt,
- ValidationCallback<T> validator, int maxTries) throws CLIException
+ ValidationCallback<T> validator, int maxTries) throws ClientException
{
int nTries = 0;
while (nTries < maxTries)
@@ -974,7 +974,7 @@
}
nTries++;
}
- throw new CLIException(ERR_TRIES_LIMIT_REACHED.get(maxTries));
+ throw new ClientException(ReturnCode.TODO, ERR_TRIES_LIMIT_REACHED.get(maxTries));
}
/**
@@ -993,12 +993,12 @@
* the Logger to be used to log the error message.
* @return Returns <code>true</code> if the user wishes the action to be
* performed, or <code>false</code> if they refused.
- * @throws CLIException
+ * @throws ClientException
* if the user did not provide valid answer after a certain number
* of tries (ConsoleApplication.CONFIRMATION_MAX_TRIES)
*/
protected final boolean askConfirmation(LocalizableMessage prompt, boolean defaultValue,
- LocalizedLogger logger) throws CLIException
+ LocalizedLogger logger) throws ClientException
{
boolean v = defaultValue;
@@ -1013,7 +1013,7 @@
v = confirmAction(prompt, defaultValue);
done = true;
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
if (StaticUtils.hasDescriptor(ce.getMessageObject(),
ERR_CONFIRMATION_TRIES_LIMIT_REACHED)
@@ -1031,7 +1031,7 @@
if (!done)
{
// This means we reached the maximum number of tries
- throw new CLIException(ERR_CONFIRMATION_TRIES_LIMIT_REACHED
+ throw new ClientException(ReturnCode.TODO, ERR_CONFIRMATION_TRIES_LIMIT_REACHED
.get(CONFIRMATION_MAX_TRIES));
}
return v;
@@ -1193,7 +1193,7 @@
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_NOT_TRUSTED.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
if (e.getCause() instanceof SSLException)
@@ -1201,13 +1201,13 @@
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT_WRONG_PORT.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
String hostPort =
ServerDescriptor.getServerRepresentation(hostName, portNumber);
LocalizableMessage message = Utils.getMessageForException(e, hostPort);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_CONNECT_ERROR,
message);
}
}
@@ -1260,12 +1260,12 @@
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, portNumber);
throw new ClientException(
- LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR, message);
+ ReturnCode.CLIENT_SIDE_CONNECT_ERROR, message);
}
}
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, portNumber);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_CONNECT_ERROR,
message);
}
}
@@ -1287,7 +1287,7 @@
{
LocalizableMessage message =
ERR_DSCFG_ERROR_LDAP_FAILED_TO_CONNECT.get(hostName, portNumber);
- throw new ClientException(LDAPResultCode.CLIENT_SIDE_CONNECT_ERROR,
+ throw new ClientException(ReturnCode.CLIENT_SIDE_CONNECT_ERROR,
message);
}
}
@@ -1344,7 +1344,7 @@
{
s = readInput(INFO_ADMINISTRATOR_UID_PROMPT.get(), defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
logger.warn(LocalizableMessage.raw("Error reading input: " + ce, ce));
}
@@ -1399,7 +1399,7 @@
{
newInt = readInteger(prompt, defaultValue);
}
- catch (CLIException ce)
+ catch (ClientException ce)
{
newInt = -1;
logger.warn(LocalizableMessage.raw("Error reading input: " + ce, ce));
@@ -1416,17 +1416,17 @@
* @param defaultValue
* The default value.
* @return Returns the value.
- * @throws CLIException
+ * @throws ClientException
* If the value could not be retrieved for some reason.
*/
public final int readInteger(LocalizableMessage prompt, final int defaultValue)
- throws CLIException
+ throws ClientException
{
ValidationCallback<Integer> callback = new ValidationCallback<Integer>()
{
@Override
public Integer validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
index 86582ac..de12ee7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/LDAPConnectionConsoleInteraction.java
@@ -41,7 +41,7 @@
import org.opends.server.tools.SSLConnectionException;
import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
import com.forgerock.opendj.cli.ArgumentException;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
import org.opends.server.util.SelectableCertificateKeyManager;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.util.ApplicationTrustManager;
@@ -364,7 +364,7 @@
{
public String validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -397,7 +397,7 @@
hostName = app.readValidatedInput(INFO_LDAP_CONN_PROMPT_HOST_NAME
.get(hostName), callback);
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
@@ -487,7 +487,7 @@
throw new RuntimeException();
}
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw new RuntimeException(e);
}
@@ -527,7 +527,7 @@
{
public Integer validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -569,7 +569,7 @@
}
portNumber = app.readValidatedInput(askPortNumber, callback);
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
@@ -620,7 +620,7 @@
{
public String validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -680,7 +680,7 @@
providedBindDN = bindDN;
}
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory
.unableToReadConnectionParameters(e);
@@ -914,7 +914,7 @@
throw new RuntimeException();
}
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw new RuntimeException(e);
@@ -933,7 +933,7 @@
ValidationCallback<String> callback = new ValidationCallback<String>()
{
public String validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -966,7 +966,7 @@
truststorePath = app.readValidatedInput(
INFO_LDAP_CONN_PROMPT_SECURITY_TRUSTSTORE_PATH.get(), callback);
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
@@ -1110,7 +1110,7 @@
ValidationCallback<String> callback = new ValidationCallback<String>()
{
public String validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -1139,7 +1139,7 @@
keystorePath = app.readValidatedInput(
INFO_LDAP_CONN_PROMPT_SECURITY_KEYSTORE_PATH.get(), callback);
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
@@ -1264,7 +1264,7 @@
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
- catch (CLIException e)
+ catch (ClientException e)
{
throw ArgumentExceptionFactory.unableToReadConnectionParameters(e);
}
@@ -1614,7 +1614,7 @@
new ValidationCallback<String>()
{
public String validate(ConsoleApplication app, String input)
- throws CLIException
+ throws ClientException
{
String ninput = input.trim();
if (ninput.length() == 0)
@@ -1649,7 +1649,7 @@
INFO_LDAP_CONN_PROMPT_SECURITY_TRUSTSTORE_PATH.get(),
callback);
}
- catch (CLIException e)
+ catch (ClientException e)
{
return true;
}
@@ -1709,7 +1709,7 @@
throw new RuntimeException();
}
}
- catch (CLIException cliE)
+ catch (ClientException cliE)
{
throw new RuntimeException(cliE);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/Menu.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/Menu.java
index 53fb9fa..485f7d0 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/Menu.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/Menu.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.util.cli;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
@@ -46,9 +46,9 @@
* with the option will be invoked and its result returned.
*
* @return Returns the result of invoking the chosen menu call-back.
- * @throws CLIException
+ * @throws ClientException
* If an I/O exception occurred or if one of the menu
* option call-backs failed for some reason.
*/
- MenuResult<T> run() throws CLIException;
+ MenuResult<T> run() throws ClientException;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuBuilder.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuBuilder.java
index 4724bec..2eb605d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuBuilder.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuBuilder.java
@@ -43,7 +43,7 @@
import org.opends.server.util.table.TableBuilder;
import org.opends.server.util.table.TablePrinter;
import org.opends.server.util.table.TextTablePrinter;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
@@ -87,7 +87,7 @@
/**
* {@inheritDoc}
*/
- public MenuResult<T> invoke(ConsoleApplication app) throws CLIException {
+ public MenuResult<T> invoke(ConsoleApplication app) throws ClientException {
List<T> values = new ArrayList<T>();
for (MenuCallback<T> callback : callbacks) {
MenuResult<T> result = callback.invoke(app);
@@ -174,7 +174,7 @@
/**
* {@inheritDoc}
*/
- public MenuResult<T> run() throws CLIException {
+ public MenuResult<T> run() throws ClientException {
// The validation call-back which will be used to determine the
// action call-back.
ValidationCallback<MenuCallback<T>> validator =
@@ -333,7 +333,7 @@
/**
* {@inheritDoc}
*/
- public MenuResult<T> invoke(ConsoleApplication app) throws CLIException {
+ public MenuResult<T> invoke(ConsoleApplication app) throws ClientException {
return result;
}
@@ -493,7 +493,7 @@
public void addHelpOption(final HelpCallback callback) {
MenuCallback<T> wrapper = new MenuCallback<T>() {
- public MenuResult<T> invoke(ConsoleApplication app) throws CLIException {
+ public MenuResult<T> invoke(ConsoleApplication app) throws ClientException {
app.println();
callback.display(app);
return MenuResult.again();
@@ -828,7 +828,7 @@
/**
* Sets the maximum number of tries that the user can provide an invalid
* value in the menu. -1 for unlimited tries (the default). If this limit is
- * reached a CLIException will be thrown.
+ * reached a ClientException will be thrown.
* @param nTries the maximum number of tries.
*/
public void setMaxTries(int nTries)
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuCallback.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuCallback.java
index 3fe42c1..608c3b0 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuCallback.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/MenuCallback.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.util.cli;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
/**
@@ -46,8 +46,8 @@
* @param app
* The application console.
* @return Returns the result of invoking the menu call-back.
- * @throws CLIException
+ * @throws ClientException
* If the menu call-back fails for some reason.
*/
- MenuResult<T> invoke(ConsoleApplication app) throws CLIException;
+ MenuResult<T> invoke(ConsoleApplication app) throws ClientException;
}
\ No newline at end of file
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/cli/ValidationCallback.java b/opendj3-server-dev/src/server/org/opends/server/util/cli/ValidationCallback.java
index 90a4bb7..c6ead77 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/cli/ValidationCallback.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/cli/ValidationCallback.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.util.cli;
-import com.forgerock.opendj.cli.CLIException;
+import com.forgerock.opendj.cli.ClientException;
/**
@@ -50,9 +50,9 @@
* The user input to be validated.
* @return Returns the decoded input if the input is valid, or
* <code>null</code> if it is not.
- * @throws CLIException
+ * @throws ClientException
* If an unexpected error occurred which prevented
* validation.
*/
- T validate(ConsoleApplication app, String input) throws CLIException;
+ T validate(ConsoleApplication app, String input) throws ClientException;
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java
index ebeb640..62e3933 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/core/RejectUnauthReqTests.java
@@ -45,6 +45,7 @@
import org.opends.server.tools.*;
import static org.testng.Assert.*;
import static org.opends.server.util.ServerConstants.*;
+import com.forgerock.opendj.cli.ClientException;
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
index c42449a..42769f4 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/tools/LDAPAuthenticationHandlerTestCase.java
@@ -52,6 +52,7 @@
import org.opends.server.types.*;
import org.forgerock.opendj.ldap.ByteString;
import static org.testng.Assert.*;
+import com.forgerock.opendj.cli.ClientException;
--
Gitblit v1.10.0