From 2f6ff691ac37186ece4603e14a80da9ac1a356d5 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Wed, 19 Sep 2007 00:49:27 +0000
Subject: [PATCH] Fix for issue 2245 in which duplicate log entries were being written to the task for persistence by the backend and causing problems. I've also prepended the message timestamp and message count numbers to make sure that the log messages are unique
---
opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java | 19 ++++++++-----------
1 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java b/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
index 5a53cdc..a44fd3a 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/task/Task.java
@@ -195,7 +195,6 @@
String taskDN = taskEntryDN.toString();
taskBackend = taskScheduler.getTaskBackend();
- logMessageCounter = 0;
// Get the task ID and recurring task ID values. At least one of them must
@@ -365,6 +364,9 @@
// Get the log messages for the task.
logMessages = getAttributeValues(ATTR_TASK_LOG_MESSAGES);
+ if (logMessages != null) {
+ logMessageCounter = logMessages.size();
+ }
}
@@ -962,30 +964,25 @@
}
List<Attribute> attrList = taskEntry.getAttribute(type);
+ LinkedHashSet<AttributeValue> values;
if (attrList == null)
{
attrList = new ArrayList<Attribute>();
-
- LinkedHashSet<AttributeValue> values =
- new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type, new ASN1OctetString(message)));
+ values = new LinkedHashSet<AttributeValue>();
attrList.add(new Attribute(type, ATTR_TASK_LOG_MESSAGES, values));
taskEntry.putAttribute(type, attrList);
}
else if (attrList.isEmpty())
{
- LinkedHashSet<AttributeValue> values =
- new LinkedHashSet<AttributeValue>();
- values.add(new AttributeValue(type, new ASN1OctetString(message)));
+ values = new LinkedHashSet<AttributeValue>();
attrList.add(new Attribute(type, ATTR_TASK_LOG_MESSAGES, values));
}
else
{
Attribute attr = attrList.get(0);
- LinkedHashSet<AttributeValue> values = attr.getValues();
- values.add(new AttributeValue(type, new ASN1OctetString(message)));
- attrList.add(new Attribute(type, ATTR_TASK_LOG_MESSAGES, values));
+ values = attr.getValues();
}
+ values.add(new AttributeValue(type, new ASN1OctetString(messageString)));
}
finally
{
--
Gitblit v1.10.0