From e451ab682bef06d6435c67e80b3a3be8adf7db2f Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 26 Sep 2007 20:05:48 +0000
Subject: [PATCH] Fix for issue 2354 (dsreplication CLI : parallel runs should raise more explicit error information). The messages have been updated with a reference to the log file and a String representation of the exception that caused the error.
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java | 2 --
opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java | 47 +++++++++++++++++++++++++++++++++++++++++++----
opendj-sdk/opends/src/messages/messages/admin_tool.properties | 6 +++---
3 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
index 6b93164..7cb75ee 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/replicationcli/ReplicationCliMain.java
@@ -2449,7 +2449,7 @@
{
returnValue = rce.getErrorCode();
printLineBreak();
- printErrorMessage(rce.getMessageObject());
+ printErrorMessage(getCriticalExceptionMessage(rce));
LOG.log(Level.SEVERE, "Complete error stack:", rce);
}
}
@@ -2542,7 +2542,7 @@
{
returnValue = rce.getErrorCode();
printLineBreak();
- printErrorMessage(rce.getMessageObject());
+ printErrorMessage(getCriticalExceptionMessage(rce));
LOG.log(Level.SEVERE, "Complete error stack:", rce);
}
}
@@ -2610,7 +2610,7 @@
{
returnValue = rce.getErrorCode();
printLineBreak();
- printErrorMessage(rce.getMessageObject());
+ printErrorMessage(getCriticalExceptionMessage(rce));
LOG.log(Level.SEVERE, "Complete error stack:", rce);
}
}
@@ -2701,7 +2701,7 @@
catch (ReplicationCliException rce)
{
printLineBreak();
- printErrorMessage(rce.getMessageObject());
+ printErrorMessage(getCriticalExceptionMessage(rce));
returnValue = rce.getErrorCode();
LOG.log(Level.SEVERE, "Complete error stack:", rce);
}
@@ -5161,4 +5161,43 @@
}
return c1;
}
+
+ /**
+ * Returns the message that must be displayed to the user for a given
+ * exception. This is assumed to be a critical exception that stops all
+ * the processing.
+ * @param rce the ReplicationCliException.
+ * @return a message to be displayed to the user.
+ */
+ private Message getCriticalExceptionMessage(ReplicationCliException rce)
+ {
+ MessageBuilder mb = new MessageBuilder();
+ mb.append(rce.getMessageObject());
+ File logFile = QuickSetupLog.getLogFile();
+ if (logFile != null)
+ {
+ mb.append(Constants.LINE_SEPARATOR);
+ mb.append(INFO_GENERAL_SEE_FOR_DETAILS.get(logFile.getPath()));
+ }
+ // Check if the cause has already been included in the message
+ Throwable c = rce.getCause();
+ if (c != null)
+ {
+ String s;
+ if (c instanceof NamingException)
+ {
+ s = ((NamingException)c).toString(true);
+ }
+ else
+ {
+ s = c.toString();
+ }
+ if (mb.toString().indexOf(s) == -1)
+ {
+ mb.append(Constants.LINE_SEPARATOR);
+ mb.append(INFO_REPLICATION_CRITICAL_ERROR_DETAILS.get(s));
+ }
+ }
+ return mb.toMessage();
+ }
}
diff --git a/opendj-sdk/opends/src/messages/messages/admin_tool.properties b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
index edb1cbd..1a6c50d 100644
--- a/opendj-sdk/opends/src/messages/messages/admin_tool.properties
+++ b/opendj-sdk/opends/src/messages/messages/admin_tool.properties
@@ -669,7 +669,7 @@
port on server %s
INFO_REPLICATION_ENABLE_CONFIGURING_BASEDN=Updating replication configuration \
for baseDN %s on server %s
- INFO_REPLICATION_ENABLE_CONFIGURING_ADS=Updating Registration configuration \
+INFO_REPLICATION_ENABLE_CONFIGURING_ADS=Updating Registration configuration \
on server %s
INFO_ENABLE_REPLICATION_INITIALIZING_ADS=Initializing Registration information \
on server %s with the contents of server %s
@@ -691,7 +691,7 @@
in servers %s and %s is different. This tool does not allow to handle this \
scenario.
SEVERE_ERR_REPLICATION_ERROR_READING_CONFIGURATION=Error reading replication \
- configuration of server %s. Details: %s
+ configuration of server %s.%nDetails: %s
INFO_REPLICATION_REMOVING_REFERENCES_ON_REMOTE=Removing references on base DN \
%s of server %s
INFO_REPLICATION_DISABLING_BASEDN=Disabling replication on base DN %s of \
@@ -723,5 +723,5 @@
INFO_REPLICATION_STATUS_LABEL_SECURE=Security:
INFO_REPLICATION_STATUS_SECURITY_ENABLED=Enabled
INFO_REPLICATION_STATUS_SECURITY_DISABLED=Disabled
-
+INFO_REPLICATION_CRITICAL_ERROR_DETAILS=Details: %s
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
index 2ffd756..79588bb 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/CliApplicationHelper.java
@@ -473,8 +473,6 @@
}
/**
-<<<<<<< .mine
-=======
* Returns <CODE>true</CODE> if this is a quiet session and
* <CODE>false</CODE> otherwise. This method relies on the a previous
* call to createArgumentParser having been made and the parser
--
Gitblit v1.10.0