From aacc0fe20e603a488176d90e50aa0b2327cc1ef8 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 29 Aug 2007 23:12:07 +0000
Subject: [PATCH] Use consistently line breaks in the uninstall and status command-lines.
---
opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java | 11 +++++------
opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java | 14 +++++++++-----
opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java | 32 ++++++++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
index e2cced9..5276892 100644
--- a/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
+++ b/opends/src/guitools/org/opends/guitools/statuspanel/StatusCli.java
@@ -272,8 +272,9 @@
catch (ArgumentException ae)
{
Message message = ERR_ERROR_PARSING_ARGS.get(ae.getMessage());
- err.println(wrap(message));
- err.println(argParser.getUsage());
+ printErrorMessage(message);
+ printLineBreak();
+ printErrorMessage(argParser.getUsage());
return ErrorReturnCode.ERROR_PARSING_ARGS.getReturnCode();
}
@@ -288,7 +289,7 @@
if (v != DsFrameworkCliReturnCode.SUCCESSFUL_NOP.getReturnCode())
{
- err.println(argParser.getUsage());
+ printErrorMessage(argParser.getUsage());
return v;
}
else
@@ -329,7 +330,6 @@
{
bindPwd = promptForPassword(
INFO_LDAPAUTH_PASSWORD_PROMPT.get(bindDn));
- printLineBreak();
prompted = true;
}
@@ -337,10 +337,12 @@
{
if (canUseSSL)
{
- useSSL = confirm(INFO_CLI_USESSL_PROMPT.get(), useSSL);
+ printLineBreak();
+ useSSL = confirm(INFO_CLI_USESSL_PROMPT.get(), useSSL);
}
if (!useSSL && canUseStartTLS)
{
+ printLineBreak();
useStartTLS =
confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS);
}
@@ -421,6 +423,7 @@
useSSL = confirm(INFO_CLI_USESSL_PROMPT.get(), useSSL);
if (!useSSL)
{
+ printLineBreak();
useStartTLS =
confirm(INFO_CLI_USESTARTTLS_PROMPT.get(), useStartTLS);
}
@@ -478,6 +481,7 @@
}
catch (ConfigException ce)
{
+ printLineBreak();
printErrorMessage(ce.getMessageObject());
}
}
diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 33643e9..eb4fcb6 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -271,6 +271,7 @@
boolean somethingSelected = false;
while (!somethingSelected)
{
+ printLineBreak();
// Ask for confirmation for the different items
Message[] keys = {
INFO_CLI_UNINSTALL_CONFIRM_LIBRARIES_BINARIES.get(),
@@ -418,10 +419,12 @@
{
if (confirmToUpdateRemote())
{
+ printLineBreak();
cancelled = !askForAuthenticationIfNeeded(userData);
if (cancelled)
{
/* Ask for confirmation to stop server */
+ printLineBreak();
cancelled = !confirmToStopServer();
}
else
@@ -430,6 +433,7 @@
interactive);
if (cancelled)
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -437,6 +441,7 @@
}
else
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -451,6 +456,7 @@
{
if (interactive)
{
+ printLineBreak();
if (confirmToUpdateRemoteAndStart())
{
boolean startWorked = startServer(userData.isQuiet());
@@ -460,6 +466,7 @@
cancelled = !askForAuthenticationIfNeeded(userData);
if (cancelled)
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -469,6 +476,7 @@
interactive);
if (cancelled)
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -479,6 +487,7 @@
userData.setStopServer(false);
if (interactive)
{
+ printLineBreak();
/* Ask for confirmation to delete files */
cancelled = !confirmDeleteFiles();
}
@@ -486,6 +495,7 @@
}
else
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -514,6 +524,7 @@
{
if (interactive)
{
+ printLineBreak();
/* Ask for confirmation to stop server */
cancelled = !confirmToStopServer();
}
@@ -530,6 +541,7 @@
userData.setStopServer(false);
if (interactive)
{
+ printLineBreak();
/* Ask for confirmation to delete files */
cancelled = !confirmDeleteFiles();
}
@@ -608,12 +620,19 @@
String ldapsUrl = conf.getLDAPSURL();
while (!couldConnect && accepted)
{
+ boolean prompted = false;
while (uid == null)
{
+ printLineBreak();
uid = askForAdministratorUID(parser.getDefaultAdministratorUID());
+ prompted = true;
}
while (pwd == null)
{
+ if (!prompted)
+ {
+ printLineBreak();
+ }
pwd = askForAdministratorPwd();
}
userData.setAdminUID(uid);
@@ -661,6 +680,7 @@
if (Utils.isCertificateException(ne))
{
+ printLineBreak();
accepted = promptForCertificateConfirmation(ne,
userData.getTrustManager(), usedUrl);
}
@@ -671,6 +691,7 @@
printLineBreak();
printErrorMessage(
Utils.getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(), ne));
+ printLineBreak();
accepted = promptToProvideAuthenticationAgain();
}
@@ -679,7 +700,9 @@
LOG.log(Level.WARNING, "Error connecting to server: "+t, t);
uid = null;
pwd = null;
+ printLineBreak();
printErrorMessage(Utils.getThrowableMsg(INFO_BUG_MSG.get(), t));
+ printLineBreak();
accepted = promptToProvideAuthenticationAgain();
}
finally
@@ -703,6 +726,7 @@
String referencedHostName = userData.getReferencedHostName();
while (referencedHostName == null)
{
+ printLineBreak();
referencedHostName = askForReferencedHostName(userData.getHostName());
}
userData.setReferencedHostName(referencedHostName);
@@ -862,6 +886,7 @@
{
LOG.log(Level.WARNING,
"Error retrieving a valid LDAP URL in conf file");
+ printLineBreak();
printErrorMessage(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
}
ADSContext adsContext = new ADSContext(ctx);
@@ -889,11 +914,13 @@
} catch (TopologyCacheException te)
{
LOG.log(Level.WARNING, "Error connecting to server: "+te, te);
+ printLineBreak();
printErrorMessage(Utils.getMessage(te));
} catch (Throwable t)
{
LOG.log(Level.WARNING, "Error connecting to server: "+t, t);
+ printLineBreak();
printErrorMessage(Utils.getThrowableMsg(INFO_BUG_MSG.get(), t));
}
finally
@@ -957,6 +984,7 @@
switch (e.getType())
{
case NOT_GLOBAL_ADMINISTRATOR:
+ printLineBreak();
printErrorMessage(INFO_NOT_GLOBAL_ADMINISTRATOR_PROVIDED.get());
stopProcessing = true;
break;
@@ -966,6 +994,7 @@
{
if (interactive)
{
+ printLineBreak();
if (promptForCertificateConfirmation(e.getCause(),
trustManager, e.getLdapUrl()))
{
@@ -980,6 +1009,7 @@
else
{
stopProcessing = true;
+ printLineBreak();
printErrorMessage(
INFO_ERROR_READING_CONFIG_LDAP_CERTIFICATE_SERVER.get(
e.getHostPort(), e.getCause().getMessage()));
@@ -998,6 +1028,7 @@
{
if (!stopProcessing && (exceptionMsgs.size() > 0))
{
+ printLineBreak();
returnValue = confirm(
ERR_UNINSTALL_READING_REGISTERED_SERVERS_CONFIRM_UPDATE_REMOTE.get(
Utils.getMessageFromCollection(exceptionMsgs,
@@ -1017,6 +1048,7 @@
{
if (exceptionMsgs.size() > 0)
{
+ printLineBreak();
printErrorMessage(Utils.getMessageFromCollection(exceptionMsgs,
Constants.LINE_SEPARATOR));
returnValue = false;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java b/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
index a5f14c3..3061c6e 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
@@ -119,8 +119,6 @@
Message defaultValue,
Message[] validValues) {
- printLineBreak();
-
boolean isValid = false;
Message response = null;
while (!isValid)
@@ -169,7 +167,6 @@
* @return The string value read from the user.
*/
protected String promptForString(Message prompt, String defaultValue) {
- printLineBreak();
String wrappedPrompt = StaticUtils.wrapText(prompt,
Utils.getCommandLineMaxLineWidth());
@@ -212,7 +209,6 @@
protected String promptForPassword(Message msg)
{
String pwd;
- printLineBreak();
String wrappedPrompt = StaticUtils.wrapText(msg,
Utils.getCommandLineMaxLineWidth());
out.print(wrappedPrompt+" ");
@@ -228,6 +224,11 @@
{
pwd = new String(pwChars);
}
+ // Sometimes the backspace trick creates problems in the terminal and
+ // out.println() does not write a new line. printing a space fixes the
+ // problem
+ out.print(" ");
+ out.flush();
}
catch (Throwable t)
{
@@ -698,7 +699,6 @@
}
else
{
- err.println();
Message msg = Utils.getThrowableMsg(INFO_ERROR_CONNECTING_TO_LOCAL.get(),
t);
printErrorMessage(msg);
@@ -767,7 +767,6 @@
}
if (displayErrorMessage)
{
- printLineBreak();
printErrorMessage(msg);
}
Message[] validValues = {
--
Gitblit v1.10.0