Program: 28973
Project: 28973
Buggy source:
/** 
 * Note: This method is not synchronized, we are assuming that the synchronization will happen at the Log Handler.publish( ) method.
 */
private String odlLogFormat(LogRecord record){
  try {
    LogEventImpl logEvent=new LogEventImpl();
    String message=getLogMessage(record);
    boolean multiLine=isMultiLine(message);
    StringBuilder recordBuffer=new StringBuilder();
    Date date=new Date();
    SimpleDateFormat dateFormatter=new SimpleDateFormat(getRecordDateFormat() != null ? getRecordDateFormat() : RFC_3339_DATE_FORMAT);
    date.setTime(record.getMillis());
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String timestamp=dateFormatter.format(date);
    logEvent.setTimestamp(timestamp);
    recordBuffer.append(timestamp);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    logEvent.setComponentId(AS_COMPONENT_NAME);
    recordBuffer.append(AS_COMPONENT_NAME);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    Level logLevel=record.getLevel();
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String odlLevel=getMapplingLogRecord(logLevel);
    logEvent.setLevel(odlLevel);
    recordBuffer.append(odlLevel);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String msgId=UniformLogFormatter.getMessageId(record);
    recordBuffer.append((msgId == null) ? "String_Node_Str" : msgId);
    logEvent.setMessageId(msgId);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    recordBuffer.append(record.getLoggerName());
    logEvent.setLogger(record.getLoggerName());
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    if (includeSuppAttrsBits.get(SupplementalAttribute.TID.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      recordBuffer.append(record.getThreadID());
      logEvent.setThreadId(record.getThreadID());
      String threadName;
      if (record instanceof GFLogRecord) {
        threadName=((GFLogRecord)record).getThreadName();
      }
 else {
        threadName=Thread.currentThread().getName();
      }
      recordBuffer.append("String_Node_Str");
      logEvent.setThreadName(threadName);
      recordBuffer.append(threadName);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.USERID.ordinal()) && userID != null && !("String_Node_Str").equals(userID.trim())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setUser(userID);
      recordBuffer.append(userID);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.ECID.ordinal()) && ecID != null && !("String_Node_Str").equals(ecID.trim())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setECId(ecID);
      recordBuffer.append(ecID);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.TIME_MILLIS.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setTimeMillis(record.getMillis());
      recordBuffer.append(record.getMillis());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.LEVEL_VALUE.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setLevelValue(logLevel.intValue());
      recordBuffer.append(logLevel.intValue());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (RECORD_NUMBER_IN_KEY_VALUE) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordNumber++;
      recordBuffer.append("String_Node_Str");
      logEvent.getSupplementalAttributes().put("String_Node_Str",recordNumber);
      recordBuffer.append(recordNumber);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    Level level=record.getLevel();
    if (LOG_SOURCE_IN_KEY_VALUE || (level.intValue() <= Level.FINE.intValue())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.getSupplementalAttributes().put("String_Node_Str",record.getSourceClassName());
      recordBuffer.append(record.getSourceClassName());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.getSupplementalAttributes().put("String_Node_Str",record.getSourceMethodName());
      recordBuffer.append(record.getSourceMethodName());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (_delegate != null) {
      _delegate.format(recordBuffer,level);
    }
    if (multiLine) {
      recordBuffer.append(FIELD_BEGIN_MARKER).append(FIELD_BEGIN_MARKER);
      recordBuffer.append(LINE_SEPARATOR);
    }
    recordBuffer.append(message);
    logEvent.setMessage(message);
    if (multiLine) {
      recordBuffer.append(FIELD_END_MARKER).append(FIELD_END_MARKER);
    }
    recordBuffer.append(LINE_SEPARATOR);
    informLogEventListeners(logEvent);
    return recordBuffer.toString();
  }
 catch (  Exception ex) {
    new ErrorManager().error("String_Node_Str",ex,ErrorManager.FORMAT_FAILURE);
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Note: This method is not synchronized, we are assuming that the synchronization will happen at the Log Handler.publish( ) method.
 */
private String odlLogFormat(LogRecord record){
  try {
    LogEventImpl logEvent=new LogEventImpl();
    String message=getLogMessage(record);
    boolean multiLine=isMultiLine(message);
    StringBuilder recordBuffer=new StringBuilder();
    Date date=new Date();
    SimpleDateFormat dateFormatter=new SimpleDateFormat(getRecordDateFormat() != null ? getRecordDateFormat() : RFC_3339_DATE_FORMAT);
    date.setTime(record.getMillis());
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String timestamp=dateFormatter.format(date);
    logEvent.setTimestamp(timestamp);
    recordBuffer.append(timestamp);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    logEvent.setComponentId(AS_COMPONENT_NAME);
    recordBuffer.append(AS_COMPONENT_NAME);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    Level logLevel=record.getLevel();
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String odlLevel=getMapplingLogRecord(logLevel);
    logEvent.setLevel(odlLevel);
    recordBuffer.append(odlLevel);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    String msgId=UniformLogFormatter.getMessageId(record);
    recordBuffer.append((msgId == null) ? "String_Node_Str" : msgId);
    logEvent.setMessageId(msgId);
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    recordBuffer.append(FIELD_BEGIN_MARKER);
    recordBuffer.append(record.getLoggerName());
    logEvent.setLogger(record.getLoggerName());
    recordBuffer.append(FIELD_END_MARKER);
    recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    if (includeSuppAttrsBits.get(SupplementalAttribute.TID.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      recordBuffer.append(record.getThreadID());
      logEvent.setThreadId(record.getThreadID());
      String threadName;
      if (record instanceof GFLogRecord) {
        threadName=((GFLogRecord)record).getThreadName();
      }
 else {
        threadName=Thread.currentThread().getName();
      }
      recordBuffer.append("String_Node_Str");
      logEvent.setThreadName(threadName);
      recordBuffer.append(threadName);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.USERID.ordinal()) && userID != null && !("String_Node_Str").equals(userID.trim())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setUser(userID);
      recordBuffer.append(userID);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.ECID.ordinal()) && ecID != null && !("String_Node_Str").equals(ecID.trim())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setECId(ecID);
      recordBuffer.append(ecID);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.TIME_MILLIS.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setTimeMillis(record.getMillis());
      recordBuffer.append(record.getMillis());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (includeSuppAttrsBits.get(SupplementalAttribute.LEVEL_VALUE.ordinal())) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordBuffer.append("String_Node_Str");
      logEvent.setLevelValue(logLevel.intValue());
      recordBuffer.append(logLevel.intValue());
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    if (RECORD_NUMBER_IN_KEY_VALUE) {
      recordBuffer.append(FIELD_BEGIN_MARKER);
      recordNumber++;
      recordBuffer.append("String_Node_Str");
      logEvent.getSupplementalAttributes().put("String_Node_Str",recordNumber);
      recordBuffer.append(recordNumber);
      recordBuffer.append(FIELD_END_MARKER);
      recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
    }
    Level level=record.getLevel();
    if (LOG_SOURCE_IN_KEY_VALUE || (level.intValue() <= Level.FINE.intValue())) {
      String sourceClassName=record.getSourceClassName();
      if (sourceClassName != null && !sourceClassName.isEmpty()) {
        recordBuffer.append(FIELD_BEGIN_MARKER);
        recordBuffer.append("String_Node_Str");
        logEvent.getSupplementalAttributes().put("String_Node_Str",sourceClassName);
        recordBuffer.append(sourceClassName);
        recordBuffer.append(FIELD_END_MARKER);
        recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
      }
      String sourceMethodName=record.getSourceMethodName();
      if (sourceMethodName != null && !sourceMethodName.isEmpty()) {
        recordBuffer.append(FIELD_BEGIN_MARKER);
        recordBuffer.append("String_Node_Str");
        logEvent.getSupplementalAttributes().put("String_Node_Str",sourceMethodName);
        recordBuffer.append(sourceMethodName);
        recordBuffer.append(FIELD_END_MARKER);
        recordBuffer.append(getRecordFieldSeparator() != null ? getRecordFieldSeparator() : FIELD_SEPARATOR);
      }
    }
    if (_delegate != null) {
      _delegate.format(recordBuffer,level);
    }
    if (multiLine) {
      recordBuffer.append(FIELD_BEGIN_MARKER).append(FIELD_BEGIN_MARKER);
      recordBuffer.append(LINE_SEPARATOR);
    }
    recordBuffer.append(message);
    logEvent.setMessage(message);
    if (multiLine) {
      recordBuffer.append(FIELD_END_MARKER).append(FIELD_END_MARKER);
    }
    recordBuffer.append(LINE_SEPARATOR);
    informLogEventListeners(logEvent);
    return recordBuffer.toString();
  }
 catch (  Exception ex) {
    new ErrorManager().error("String_Node_Str",ex,ErrorManager.FORMAT_FAILURE);
    return "String_Node_Str";
  }
}