From f0ad7d963703f4a8debd98bd6785e69e407dc13f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 30 Oct 2013 16:49:18 +0000
Subject: [PATCH] InitializeTargetTask.java: In runTask(), improved error logging in case of exceptions. Little code cleanup.

---
 opends/src/messages/messages/backend_de.properties                                |    1 
 opends/src/messages/messages/backend.properties                                   |    4 
 opends/src/messages/messages/backend_zh_CN.properties                             |    1 
 opends/src/messages/messages/backend_ca_ES.properties                             |    1 
 opends/src/messages/messages/backend_es.properties                                |    4 
 opends/src/messages/messages/backend_fr.properties                                |    4 
 opends/src/messages/messages/backend_pl.properties                                |    1 
 opends/src/server/org/opends/server/replication/common/DSInfo.java                |   39 ++++--------
 opends/src/server/org/opends/server/backends/task/TaskThread.java                 |   37 +++++------
 opends/src/server/org/opends/server/tasks/InitializeTargetTask.java               |   46 ++++++++-------
 opends/src/messages/messages/replication.properties                               |   14 ++--
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |    5 -
 opends/src/messages/messages/backend_ja.properties                                |    1 
 13 files changed, 70 insertions(+), 88 deletions(-)

diff --git a/opends/src/messages/messages/backend.properties b/opends/src/messages/messages/backend.properties
index eb3231d..a09e771 100644
--- a/opends/src/messages/messages/backend.properties
+++ b/opends/src/messages/messages/backend.properties
@@ -21,7 +21,7 @@
 # CDDL HEADER END
 #
 #      Copyright 2006-2010 Sun Microsystems, Inc.
-#      Portions Copyright 2011 ForgeRock AS
+#      Portions Copyright 2011-2013 ForgeRock AS
 
 
 #
@@ -1030,7 +1030,7 @@
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=Unable to schedule task %s \
 because its dependency task %s is missing
 NOTICE_TASK_STARTED_413=%s task %s started execution
-NOTICE_TASK_FINISHED_414=%s task %s finished execution
+NOTICE_TASK_FINISHED_414=%s task %s finished execution in the state %s
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=Unable to \
  add ldap syntax description with OID %s because it conflicts with an existing ldap syntax description
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=Unable to remove ldap syntax \
diff --git a/opends/src/messages/messages/backend_ca_ES.properties b/opends/src/messages/messages/backend_ca_ES.properties
index 973bc19..62e1c3b 100644
--- a/opends/src/messages/messages/backend_ca_ES.properties
+++ b/opends/src/messages/messages/backend_ca_ES.properties
@@ -8,5 +8,4 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=La base de dades d'infraestructura de fons (Backend): %s, no especifica el n\u00famero de taules bloquejades: predeterminant a %d
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=No es pot programar la tasca %s perqu\u00e8 falta la seva depend\u00e8ncia %s
 NOTICE_TASK_STARTED_413=%s tasca %s iniciada l'execuci\u00f3
-NOTICE_TASK_FINISHED_414=%s tasca %s finalitzada l'execuci\u00f3
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=No es pot afegir la descripci\u00f3 de sintaxis ldap amb l'OID %s perqu\u00e8 aquest entra amb conflict amb una descripci\u00f3 de sintaxis ldap existent
diff --git a/opends/src/messages/messages/backend_de.properties b/opends/src/messages/messages/backend_de.properties
index c56c405..e08bc7f 100644
--- a/opends/src/messages/messages/backend_de.properties
+++ b/opends/src/messages/messages/backend_de.properties
@@ -425,7 +425,6 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=Lokaler DB-Backend %s gibt nicht die Anzahl der verriegelten Tabellen an: Zur\u00fccksetzen auf %d
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=Aufgabe %s konnte nicht geplant werden, da deren Abh\u00e4ngigkeitsaufgabe %s fehlt
 NOTICE_TASK_STARTED_413=%s-Aufgabe %s startete die Ausf\u00fchrung
-NOTICE_TASK_FINISHED_414=%s-Aufgabe %s beendete die Ausf\u00fchrung
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=Ldap-Syntaxbeschreibung mit OID %s kann nicht hinzugef\u00fcgt werden, da ein Konflikt mit einer vorhandenen ldap-Syntaxbeschreibung besteht
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=Ldap-Syntaxbeschreibung %s kann nicht aus dem Serverschema entfernt werden, da eine solche ldap-Syntaxbeschreibung nicht definiert ist
 MILD_ERR_ATTR_SYNTAX_INVALID_LDAP_SYNTAX_417=Der angegebene Wert "%s" konnte nicht als ldap-Syntax analysiert werden, da seine OID %s einer bereits implementierten Attributsyntax entspricht
diff --git a/opends/src/messages/messages/backend_es.properties b/opends/src/messages/messages/backend_es.properties
index 58ed981..5e67ef0 100644
--- a/opends/src/messages/messages/backend_es.properties
+++ b/opends/src/messages/messages/backend_es.properties
@@ -21,7 +21,7 @@
 # CDDL HEADER END
 #
 #      Copyright 2006-2009 Sun Microsystems, Inc.
-#      Portions Copyright 2011 ForgeRock AS
+#      Portions Copyright 2011-2013 ForgeRock AS
 
 
 
@@ -425,7 +425,7 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=La copia de seguridad de DB local %s no especifica el n\u00famero de tablas de bloqueo: estableciendo de forma predeterminada en %d
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=No se puede programar la tarea %s porque falta su tarea de dependencia %s
 NOTICE_TASK_STARTED_413=Tarea de %s %s ha iniciado la ejecuci\u00f3n
-NOTICE_TASK_FINISHED_414=Tarea de %s %s ha finalizado la ejecuci\u00f3n
+NOTICE_TASK_FINISHED_414=Tarea de %s %s ha finalizado la ejecuci\u00f3n en el estado %s
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=No se puede agregar la descripci\u00f3n de sintaxis LDAP con OID %s porque est\u00e1 en conflicto con una descripci\u00f3n de sintaxis de LDAP existente
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=No se puede suprimir la descripci\u00f3n de sintaxis LDAP %s del esquema de servidor porque no se ha definido dicha descripci\u00f3n de sintaxis LDAP
 MILD_ERR_ATTR_SYNTAX_INVALID_LDAP_SYNTAX_417=No se pudo analizar el valor proporcionado "%s" como sintaxis LDAP porque su OID %s corresponde a una sintaxis de atributo que ya se ha implementado
diff --git a/opends/src/messages/messages/backend_fr.properties b/opends/src/messages/messages/backend_fr.properties
index afda623..415e9bc 100644
--- a/opends/src/messages/messages/backend_fr.properties
+++ b/opends/src/messages/messages/backend_fr.properties
@@ -21,7 +21,7 @@
 # CDDL HEADER END
 #
 #      Copyright 2006-2009 Sun Microsystems, Inc.
-#      Portions Copyright 2011 ForgeRock AS
+#      Portions Copyright 2011-2013 ForgeRock AS
 
 
 
@@ -425,7 +425,7 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=Le backend de DB local %s n'indique pas le nombre de threads de nettoyage\u00a0: il est par d\u00e9faut \u00e0 %d
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=Impossible de planifier la t\u00e2che %s car la t\u00e2che d\u00e9pendante %s est manquante
 NOTICE_TASK_STARTED_413=T\u00e2che %s %s a commenc\u00e9 l'ex\u00e9cution
-NOTICE_TASK_FINISHED_414=%s t\u00e2che %s a termin\u00e9 l'ex\u00e9cution
+NOTICE_TASK_FINISHED_414=%s t\u00e2che %s a termin\u00e9 l'ex\u00e9cution dans l'\u00e9tat %s
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=Impossible d'ajouter la description de syntaxe ldap avec OID %s car elle entre en conflit avec une description de syntaxe ldap existante
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=Impossible de supprimer la description de syntaxe ldap %s du sch\u00e9ma du serveur car elle n'est pas d\u00e9finie
 MILD_ERR_ATTR_SYNTAX_INVALID_LDAP_SYNTAX_417=Impossible d'analyser la valeur indiqu\u00e9e "%s" en tant que syntaxe ldap car son OID %s correspond \u00e0 une syntaxe d'attribut d\u00e9j\u00e0 impl\u00e9ment\u00e9e
diff --git a/opends/src/messages/messages/backend_ja.properties b/opends/src/messages/messages/backend_ja.properties
index 61bd139..4d9504b 100644
--- a/opends/src/messages/messages/backend_ja.properties
+++ b/opends/src/messages/messages/backend_ja.properties
@@ -424,7 +424,6 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=\u30ed\u30fc\u30ab\u30eb DB \u30d0\u30c3\u30af\u30a8\u30f3\u30c9 %s \u306b\u30ed\u30c3\u30af\u30c6\u30fc\u30d6\u30eb\u306e\u6570\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u307e\u305b\u3093: \u30c7\u30d5\u30a9\u30eb\u30c8\u306e %d \u500b\u306b\u8a2d\u5b9a\u3055\u308c\u307e\u3059\u3002
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=\u30bf\u30b9\u30af %s \u3092\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u3067\u304d\u307e\u305b\u3093\u3002\u4f9d\u5b58\u30bf\u30b9\u30af %s \u304c\u3042\u308a\u307e\u305b\u3093
 NOTICE_TASK_STARTED_413=%s \u30bf\u30b9\u30af %s \u304c\u5b9f\u884c\u3092\u958b\u59cb\u3057\u307e\u3057\u305f
-NOTICE_TASK_FINISHED_414=%s \u30bf\u30b9\u30af %s \u304c\u5b9f\u884c\u3092\u7d42\u4e86\u3057\u307e\u3057\u305f
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=OID %s \u3092\u542b\u3080 LDAP \u69cb\u6587\u306e\u8aac\u660e\u3092\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002\u65e2\u5b58\u306e LDAP \u69cb\u6587\u306e\u8aac\u660e\u3068\u7af6\u5408\u3057\u307e\u3059
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=LDAP \u69cb\u6587\u306e\u8aac\u660e %s \u3092\u30b5\u30fc\u30d0\u30fc\u30b9\u30ad\u30fc\u30de\u304b\u3089\u524a\u9664\u3067\u304d\u307e\u305b\u3093\u3002\u305d\u306e\u3088\u3046\u306a LDAP \u69cb\u6587\u306e\u8aac\u660e\u304c\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u307e\u305b\u3093
 MILD_ERR_ATTR_SYNTAX_INVALID_LDAP_SYNTAX_417=\u6307\u5b9a\u3055\u308c\u305f\u5024 "%s" \u3092 LDAP \u69cb\u6587\u3068\u3057\u3066\u89e3\u6790\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002OID %s \u304c\u3059\u3067\u306b\u5b9f\u88c5\u3055\u308c\u3066\u3044\u308b\u5c5e\u6027\u69cb\u6587\u306b\u5bfe\u5fdc\u3059\u308b\u305f\u3081\u3067\u3059
diff --git a/opends/src/messages/messages/backend_pl.properties b/opends/src/messages/messages/backend_pl.properties
index 4b4b117..a3341cc 100644
--- a/opends/src/messages/messages/backend_pl.properties
+++ b/opends/src/messages/messages/backend_pl.properties
@@ -1,6 +1,5 @@
 NOTICE_BACKEND_OFFLINE_370=Zaplecze %s zostaje teraz wy\u0142\u0105czone
 INFO_ERGONOMIC_SIZING_OF_JE_CLEANER_THREADS_410=Lokalne zaplecze bazy danych %s nie okre\u015bla ilo\u015bci czystszych w\u0105tk\u00f3w: u\u017cywam domy\u015blnych %d w\u0105tk\u00f3w
-NOTICE_TASK_FINISHED_414=%s zadanie %s zako\u0144czy\u0142o wykonywanie
 NOTICE_TASK_STARTED_413=%s zadanie %s rozpocz\u0119\u0142o wykonywanie
 SEVERE_ERR_TASKS_BACKUP_CANNOT_BACKUP_TASKS_FILE_384=Wyst\u0105pi\u0142 b\u0142\u0105d podczas pr\u00f3by backupu pliku zada\u0144 %s:  %s
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=Lokalne zaplecze bazy danych %s nie okre\u015bla ilo\u015bci tabel blokowanych: u\u017cywam domy\u015blnych %d
diff --git a/opends/src/messages/messages/backend_zh_CN.properties b/opends/src/messages/messages/backend_zh_CN.properties
index 93ad1e5..84ceb8c 100644
--- a/opends/src/messages/messages/backend_zh_CN.properties
+++ b/opends/src/messages/messages/backend_zh_CN.properties
@@ -424,7 +424,6 @@
 INFO_ERGONOMIC_SIZING_OF_JE_LOCK_TABLES_411=\u672c\u5730 DB \u540e\u7aef %s \u672a\u6307\u5b9a\u9501\u5b9a\u8868\u7684\u6570\u76ee: \u9ed8\u8ba4\u4e3a %d \u4e2a
 SEVERE_ERR_TASKSCHED_DEPENDENCY_MISSING_412=\u65e0\u6cd5\u8ba1\u5212\u4efb\u52a1 %s\uff0c\u56e0\u4e3a\u7f3a\u5c11\u5176\u4f9d\u8d56\u4efb\u52a1 %s
 NOTICE_TASK_STARTED_413=%s \u4efb\u52a1 %s \u5df2\u5f00\u59cb\u6267\u884c
-NOTICE_TASK_FINISHED_414=%s \u4efb\u52a1 %s \u5df2\u5b8c\u6210\u6267\u884c
 MILD_ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX_415=\u65e0\u6cd5\u6dfb\u52a0\u5177\u6709 OID %s \u7684 ldap \u8bed\u6cd5\u63cf\u8ff0\uff0c\u56e0\u4e3a\u5b83\u4e0e\u73b0\u6709 ldap \u8bed\u6cd5\u63cf\u8ff0\u53d1\u751f\u51b2\u7a81
 MILD_ERR_SCHEMA_MODIFY_REMOVE_NO_SUCH_LSD_416=\u65e0\u6cd5\u4ece\u670d\u52a1\u5668\u6a21\u5f0f\u4e2d\u5220\u9664 ldap \u8bed\u6cd5\u63cf\u8ff0 %s\uff0c\u56e0\u4e3a\u672a\u5b9a\u4e49\u6b64\u7c7b ldap \u8bed\u6cd5\u63cf\u8ff0
 MILD_ERR_ATTR_SYNTAX_INVALID_LDAP_SYNTAX_417=\u65e0\u6cd5\u5c06\u63d0\u4f9b\u7684\u503c "%s" \u89e3\u6790\u4e3a ldap \u8bed\u6cd5\uff0c\u56e0\u4e3a\u5176 OID %s \u5bf9\u5e94\u4e8e\u5df2\u5b9e\u73b0\u7684\u5c5e\u6027\u8bed\u6cd5
diff --git a/opends/src/messages/messages/replication.properties b/opends/src/messages/messages/replication.properties
index adf6109..eb9abc4 100644
--- a/opends/src/messages/messages/replication.properties
+++ b/opends/src/messages/messages/replication.properties
@@ -95,7 +95,7 @@
 MILD_ERR_LOOP_REPLAYING_OPERATION_35=A loop was detected while replaying \
  operation: %s error %s
 MILD_ERR_FILE_CHECK_CREATE_FAILED_36=An Exception was caught while testing \
- existence or trying  to create the directory for the Replication Server \
+ existence or trying to create the directory for the Replication Server \
  database : %s
 SEVERE_ERR_SIMULTANEOUS_IMPORT_EXPORT_REJECTED_44=The current request is \
  rejected due to an import or an export already in progress for the same data
@@ -137,7 +137,7 @@
  ChangeNumber %s error %s %s
 MILD_ERR_UNKNOWN_ATTRIBUTE_IN_HISTORICAL_68=The entry %s has historical \
  information for attribute %s which is not defined in the schema. This \
-  information will be ignored
+ information will be ignored
 NOTICE_UNRESOLVED_CONFLICT_69=An unresolved conflict was detected for DN %s
 SEVERE_ERR_COULD_NOT_CLOSE_THE_SOCKET_70=The Replication Server socket could not \
  be closed : %s
@@ -148,8 +148,8 @@
 SEVERE_ERR_SEARCHING_DOMAIN_BACKEND_74=An unexpected error occurred when \
 looking for the replicated backend : %s. It may be not configured or disabled
 SEVERE_ERR_LOADING_GENERATION_ID_75=An unexpected error occurred when \
-searching in %s for the generation ID  : %s
-SEVERE_ERR_UPDATING_GENERATION_ID_76=An unexpected error %s occurred  \
+searching in %s for the generation ID : %s
+SEVERE_ERR_UPDATING_GENERATION_ID_76=An unexpected error %s occurred \
 when updating generation ID for the domain : %s
 MILD_ERR_ERROR_MSG_RECEIVED_79=The following error has been received : %s
 SEVERE_ERR_INIT_IMPORT_NOT_SUPPORTED_82= Initialization cannot be done because \
@@ -181,10 +181,10 @@
 SEVERE_ERR_UNKNOWN_DN_95=The base DN %s is not stored by any of the \
  Directory Server backend
 SEVERE_ERR_REPLICATONBACKEND_IMPORT_LDIF_NOT_SUPPORTED_98=The replication \
-  server backend does not support the import ldif function
+ server backend does not support the import ldif function
 SEVERE_ERR_REPLICATONBACKEND_EXPORT_LDIF_FAILED_99=The replication \
-  server backend cannot export its entries in LDIF format because the \
-  export-ldif command must be run as a task
+ server backend cannot export its entries in LDIF format because the \
+ export-ldif command must be run as a task
 SEVERE_ERR_PROCESSING_REMOTE_MONITOR_DATA_107=Monitor data of remote servers \
  are missing due to a processing error : %s
 SEVERE_ERR_SENDING_REMOTE_MONITOR_DATA_REQUEST_108=Unable to send monitor data \
diff --git a/opends/src/server/org/opends/server/backends/task/TaskThread.java b/opends/src/server/org/opends/server/backends/task/TaskThread.java
index 0c53c92..b6479fc 100644
--- a/opends/src/server/org/opends/server/backends/task/TaskThread.java
+++ b/opends/src/server/org/opends/server/backends/task/TaskThread.java
@@ -23,33 +23,28 @@
  *
  *
  *      Copyright 2006-2009 Sun Microsystems, Inc.
+ *      Portions copyright 2013 ForgeRock AS
  */
 package org.opends.server.backends.task;
+
+import java.util.Map;
+
 import org.opends.messages.Message;
-
-
-
 import org.opends.server.api.DirectoryThread;
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.types.DebugLogLevel;
 
-import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.loggers.ErrorLogger.*;
 import static org.opends.messages.BackendMessages.*;
-
+import static org.opends.server.loggers.ErrorLogger.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
 import static org.opends.server.util.StaticUtils.*;
 
-import java.util.Map;
-
-
-
 /**
  * This class defines a thread that will be used to execute a scheduled task
  * within the server and provide appropriate notification that the task is
  * complete.
  */
-public class TaskThread
-       extends DirectoryThread
+public class TaskThread extends DirectoryThread
 {
   /**
    * The tracer object for the debug logger.
@@ -58,17 +53,19 @@
 
 
 
-  // Indicates whether a request has been made for this thread to exit.
+  /** Indicates whether a request has been made for this thread to exit. */
   private volatile boolean exitRequested;
 
-  // The thread ID for this task thread.
+  /** The thread ID for this task thread. */
   private int threadID;
 
-  // The reference to the scheduler with which this thread is associated.
+  /** The reference to the scheduler with which this thread is associated. */
   private TaskScheduler taskScheduler;
 
-  // The object that will be used for signaling the thread when there is new
-  // work to perform.
+  /**
+   * The object that will be used for signaling the thread when there is new
+   * work to perform.
+   */
   private final Object notifyLock;
 
 
@@ -206,8 +203,8 @@
 
           taskState = task.execute();
 
-          message = NOTE_TASK_FINISHED.get(
-            task.getDisplayName(), task.getTaskID());
+          message = NOTE_TASK_FINISHED.get(task.getDisplayName(),
+              task.getTaskID(), taskState.getDisplayName());
           logError(message);
         }
       }
@@ -247,7 +244,7 @@
 
 
   /**
-   * Retrieves any relevent debug information with which this tread is
+   * Retrieves any relevant debug information with which this tread is
    * associated so they can be included in debug messages.
    *
    * @return debug information about this thread as a string.
diff --git a/opends/src/server/org/opends/server/replication/common/DSInfo.java b/opends/src/server/org/opends/server/replication/common/DSInfo.java
index e4ecab5..605ed19 100644
--- a/opends/src/server/org/opends/server/replication/common/DSInfo.java
+++ b/opends/src/server/org/opends/server/replication/common/DSInfo.java
@@ -323,32 +323,19 @@
   public String toString()
   {
     StringBuilder sb = new StringBuilder();
-    sb.append("\nDS id: ");
-    sb.append(dsId);
-    sb.append(" ; DS url: ");
-    sb.append(dsUrl);
-    sb.append(" ; RS id: ");
-    sb.append(rsId);
-    sb.append(" ; Generation id: ");
-    sb.append(generationId);
-    sb.append(" ; Status: ");
-    sb.append(status);
-    sb.append(" ; Assured replication: ");
-    sb.append(assuredFlag);
-    sb.append(" ; Assured mode: ");
-    sb.append(assuredMode);
-    sb.append(" ; Safe data level: ");
-    sb.append(safeDataLevel);
-    sb.append(" ; Group id: ");
-    sb.append(groupId);
-    sb.append(" ; Protocol version: ");
-    sb.append(protocolVersion);
-    sb.append(" ; Referral URLs: ");
-    sb.append(refUrls);
-    sb.append(" ; ECL Include: ");
-    sb.append(eclIncludes);
-    sb.append(" ; ECL Include for Deletes: ");
-    sb.append(eclIncludesForDeletes);
+    sb.append("DS id: ").append(dsId);
+    sb.append(" ; DS url: ").append(dsUrl);
+    sb.append(" ; RS id: ").append(rsId);
+    sb.append(" ; Generation id: ").append(generationId);
+    sb.append(" ; Status: ").append(status);
+    sb.append(" ; Assured replication: ").append(assuredFlag);
+    sb.append(" ; Assured mode: ").append(assuredMode);
+    sb.append(" ; Safe data level: ").append(safeDataLevel);
+    sb.append(" ; Group id: ").append(groupId);
+    sb.append(" ; Protocol version: ").append(protocolVersion);
+    sb.append(" ; Referral URLs: ").append(refUrls);
+    sb.append(" ; ECL Include: ").append(eclIncludes);
+    sb.append(" ; ECL Include for Deletes: ").append(eclIncludesForDeletes);
     return sb.toString();
   }
 
diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index d6ee68e..821f7b8 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -3491,9 +3491,8 @@
 
       if (result != ResultCode.SUCCESS)
       {
-        Message message = ERR_UPDATING_GENERATION_ID.get(
-            result.getResultCodeName() + " " , getBaseDNString());
-        logError(message);
+        logError(ERR_UPDATING_GENERATION_ID.get(
+            result.getResultCodeName(), getBaseDNString()));
       }
     }
     else
diff --git a/opends/src/server/org/opends/server/tasks/InitializeTargetTask.java b/opends/src/server/org/opends/server/tasks/InitializeTargetTask.java
index 817e4c9..499f19d 100644
--- a/opends/src/server/org/opends/server/tasks/InitializeTargetTask.java
+++ b/opends/src/server/org/opends/server/tasks/InitializeTargetTask.java
@@ -27,10 +27,6 @@
  */
 package org.opends.server.tasks;
 
-import static org.opends.server.config.ConfigConstants.*;
-import static org.opends.server.core.DirectoryServer.*;
-import static org.opends.server.loggers.debug.DebugLogger.*;
-
 import java.util.List;
 
 import org.opends.messages.Message;
@@ -42,6 +38,12 @@
 import org.opends.server.replication.plugin.LDAPReplicationDomain;
 import org.opends.server.types.*;
 
+import static org.opends.messages.BackendMessages.*;
+import static org.opends.server.config.ConfigConstants.*;
+import static org.opends.server.core.DirectoryServer.*;
+import static org.opends.server.loggers.debug.DebugLogger.*;
+import static org.opends.server.util.StaticUtils.*;
+
 /**
  * This class provides an implementation of a Directory Server task that can
  * be used to import data from an LDIF file into a backend.
@@ -54,8 +56,8 @@
   private static final DebugTracer TRACER = getTracer();
 
   // Config properties
-  private String  domainString            = null;
-  private LDAPReplicationDomain domain = null;
+  private String domainString;
+  private LDAPReplicationDomain domain;
   private int target;
   private long total;
 
@@ -70,7 +72,8 @@
   /**
    * {@inheritDoc}
    */
-  @Override public void initializeTask() throws DirectoryException
+  @Override
+  public void initializeTask() throws DirectoryException
   {
     if (TaskState.isDone(getTaskState()))
     {
@@ -80,16 +83,12 @@
     // FIXME -- Do we need any special authorization here?
     Entry taskEntry = getTaskEntry();
 
-    AttributeType typeDomainBase;
-    AttributeType typeScope;
-
-    typeDomainBase =
+    AttributeType typeDomainBase =
       getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN, true);
-    typeScope =
+    AttributeType typeScope =
       getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE, true);
 
-    List<Attribute> attrList;
-    attrList = taskEntry.getAttribute(typeDomainBase);
+    List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase);
     domainString = TaskUtils.getSingleValueString(attrList);
 
     try
@@ -102,7 +101,8 @@
     {
       MessageBuilder mb = new MessageBuilder();
       mb.append(TaskMessages.ERR_TASK_INITIALIZE_INVALID_DN.get());
-      mb.append(e.getMessage());
+      mb.append(" ");
+      mb.append(stackTraceToSingleLineString(e));
       throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, e);
     }
 
@@ -127,12 +127,17 @@
     {
       domain.initializeRemote(target, this);
     }
-    catch(DirectoryException de)
+    catch (DirectoryException e)
     {
+      if (debugEnabled())
+      {
+        TRACER.debugCaught(DebugLogLevel.ERROR, e);
+      }
+
       // This log will go to the task log message
-      MessageBuilder mb = new MessageBuilder();
-      mb.append(de.getMessageObject());
-      logError(mb.toMessage());
+      Message message = ERR_TASK_EXECUTE_FAILED.get(
+          String.valueOf(getTaskEntryDN()), stackTraceToSingleLineString(e));
+      logError(message);
 
       return TaskState.STOPPED_BY_ERROR;
     }
@@ -147,8 +152,7 @@
   public void setTotal(long total) throws DirectoryException
   {
     this.total = total;
-    replaceAttributeValue(ATTR_TASK_INITIALIZE_LEFT,
-        String.valueOf(total));
+    replaceAttributeValue(ATTR_TASK_INITIALIZE_LEFT, String.valueOf(total));
     replaceAttributeValue(ATTR_TASK_INITIALIZE_DONE, String.valueOf(0));
   }
 

--
Gitblit v1.10.0