From 300625b855bded33c79af6570d9bcdd6f9aca7c6 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 07 Jul 2009 00:12:51 +0000
Subject: [PATCH] Improve the displayed messages when an ADSContextException occurs. i18n the messages of the ADSContextException. Make dsreplication consistent with the fix made for dsconfig (see issue 4091). Fix a bug in ADSContext when deleting the contents of the ADS. Fix a bug in the equivalent command display when the user chooses to disable all replication on a server or to disable the replication server.
---
opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java | 65 +++++++++++++++++++++++++-------
1 files changed, 51 insertions(+), 14 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
index 77067cf..5044e92 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -5137,7 +5137,7 @@
catch (ADSContextException adce)
{
throw new ReplicationCliException(
- ERR_REPLICATION_UPDATING_ADS.get(adce.getReason()),
+ ERR_REPLICATION_UPDATING_ADS.get(adce.getMessageObject()),
ERROR_UPDATING_ADS, adce);
}
if (!adsAlreadyReplicated)
@@ -5789,10 +5789,12 @@
{
LOG.log(Level.INFO, "Error unregistering server: "+
server.getAdsProperties(), adce);
- println();
- println(
- ERR_REPLICATION_UPDATING_ADS.get(adce.getMessage()));
- println();
+ if (adce.getError() != ADSContextException.ErrorType.NOT_YET_REGISTERED)
+ {
+ throw new ReplicationCliException(
+ ERR_REPLICATION_UPDATING_ADS.get(adce.getMessageObject()),
+ ERROR_READING_ADS, adce);
+ }
}
}
@@ -5942,10 +5944,13 @@
{
LOG.log(Level.WARNING, "Error unregistering server: "+
s.getAdsProperties(), adce);
- println();
- println(
- ERR_REPLICATION_UPDATING_ADS.get(adce.getMessage()));
- println();
+ if (adce.getError() !=
+ ADSContextException.ErrorType.NOT_YET_REGISTERED)
+ {
+ throw new ReplicationCliException(
+ ERR_REPLICATION_UPDATING_ADS.get(adce.getMessageObject()),
+ ERROR_READING_ADS, adce);
+ }
}
}
}
@@ -5977,15 +5982,15 @@
}
adsCtx.createAdminData(adminBackendName);
printProgress(formatter.getFormattedDone());
+ printlnProgress();
}
catch (ADSContextException adce)
{
LOG.log(Level.SEVERE, "Error resetting contents of cn=admin data: "+
adce, adce);
- println();
- println(
- ERR_REPLICATION_UPDATING_ADS.get(adce.getMessage()));
- println();
+ throw new ReplicationCliException(
+ ERR_REPLICATION_UPDATING_ADS.get(adce.getMessageObject()),
+ ERROR_READING_ADS, adce);
}
}
}
@@ -8307,6 +8312,10 @@
{
s = ((NamingException)c).toString(true);
}
+ else if (c instanceof OpenDsException)
+ {
+ s = ((OpenDsException)c).getMessageObject().toString();
+ }
else
{
s = c.toString();
@@ -8903,9 +8912,14 @@
try
{
BufferedWriter writer =
- new BufferedWriter(new FileWriter(file, false));
+ new BufferedWriter(new FileWriter(file, true));
+
+ writer.write(SHELL_COMMENT_SEPARATOR+getCurrentOperationDateMessage());
+ writer.newLine();
+
writer.write(commandBuilder.toString());
writer.newLine();
+ writer.newLine();
writer.flush();
writer.close();
@@ -8999,6 +9013,29 @@
}
}
+ if (subcommandName.equals(
+ ReplicationCliArgumentParser.DISABLE_REPLICATION_SUBCMD_NAME))
+ {
+ DisableReplicationUserData disableData =
+ (DisableReplicationUserData)uData;
+ if (disableData.disableAll())
+ {
+ commandBuilder.addArgument(new BooleanArgument(
+ argParser.disableAllArg.getName(),
+ argParser.disableAllArg.getShortIdentifier(),
+ argParser.disableAllArg.getLongIdentifier(),
+ INFO_DESCRIPTION_DISABLE_ALL.get()));
+ }
+ else if (disableData.disableReplicationServer())
+ {
+ commandBuilder.addArgument(new BooleanArgument(
+ argParser.disableReplicationServerArg.getName(),
+ argParser.disableReplicationServerArg.getShortIdentifier(),
+ argParser.disableReplicationServerArg.getLongIdentifier(),
+ INFO_DESCRIPTION_DISABLE_REPLICATION_SERVER.get()));
+ }
+ }
+
addGlobalArguments(commandBuilder, uData);
return commandBuilder;
}
--
Gitblit v1.10.0