mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

kenneth_suter
19.49.2007 8169fc766bea7a95657b46dc04cfa18a0c0c3bf8
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
1 files modified
19 ■■■■■ changed files
opends/src/server/org/opends/server/backends/task/Task.java 19 ●●●●● patch | view | raw | blame | history
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
    {