Program: 134777
Project: 134777
Buggy source:
/** 
 * Internal flush method which covers straight calls to flush as well as scheduled calls. <p> Threading note: this method is thread safe because competing threads are blocked on a flush lock (and additionally on <code>queue.drainTo(..)</code>), so that the second thread may unexpectedly not find any log records and thus will return immediately.
 * @param isScheduled true if this method is called by a timer, as opposed to some more direct thread. Used only for debugging. 
 * @return Success indicator: true if all or at least some log records were permanently taken off the queue by this flush request.
 */
private boolean flush(boolean isScheduled){
  if (DEBUG) {
    System.out.println("String_Node_Str" + isScheduled + "String_Node_Str"+ Thread.currentThread().getName());
  }
  boolean flushedSomeRecords=false;
  if (!hasRemoteDispatcher()) {
    System.err.println("String_Node_Str");
  }
 else {
    flushLock.lock();
    try {
      int bufferSize=remoteLogDispatcher.getBufferSize();
      int queueSize=queue.size();
      LogRecord[] allRecords=queue.toArray(new LogRecord[queueSize]);
      final LogRecord[] logRecords;
      if (queueSize > bufferSize) {
        logRecords=new LogRecord[bufferSize];
        System.arraycopy(allRecords,0,logRecords,0,bufferSize);
      }
 else {
        logRecords=new LogRecord[queueSize];
        System.arraycopy(allRecords,0,logRecords,0,queueSize);
      }
      if (logRecords.length != 0) {
        flushedSomeRecords=flushLogRecords(logRecords);
        if (flushedSomeRecords) {
          if (DEBUG) {
            System.out.println("String_Node_Str");
          }
          flushIfEnoughRecords(false);
        }
      }
 else {
        if (DEBUG) {
          System.err.println("String_Node_Str" + isScheduled + "String_Node_Str");
        }
      }
    }
  finally {
      flushLock.unlock();
    }
  }
  return flushedSomeRecords;
}

Fixed version (ground truth):
/** 
 * Internal flush method which covers straight calls to flush as well as scheduled calls. <p> Threading note: this method is thread safe because competing threads are blocked on a flush lock (and additionally on <code>queue.drainTo(..)</code>), so that the second thread may unexpectedly not find any log records and thus will return immediately.
 * @param isScheduled true if this method is called by a timer, as opposed to some more direct thread. Used only for debugging. 
 * @return Success indicator: true if all or at least some log records were permanently taken off the queue by this flush request.
 */
private boolean flush(boolean isScheduled){
  if (DEBUG) {
    System.out.println("String_Node_Str" + isScheduled + "String_Node_Str"+ Thread.currentThread().getName());
  }
  boolean flushedSomeRecords=false;
  if (!hasRemoteDispatcher()) {
    System.out.println("String_Node_Str");
  }
 else {
    flushLock.lock();
    try {
      int bufferSize=remoteLogDispatcher.getBufferSize();
      int queueSize=queue.size();
      LogRecord[] allRecords=queue.toArray(new LogRecord[queueSize]);
      final LogRecord[] logRecords;
      if (queueSize > bufferSize) {
        logRecords=new LogRecord[bufferSize];
        System.arraycopy(allRecords,0,logRecords,0,bufferSize);
      }
 else {
        logRecords=new LogRecord[queueSize];
        System.arraycopy(allRecords,0,logRecords,0,queueSize);
      }
      if (logRecords.length != 0) {
        flushedSomeRecords=flushLogRecords(logRecords);
        if (flushedSomeRecords) {
          if (DEBUG) {
            System.out.println("String_Node_Str");
          }
          flushIfEnoughRecords(false);
        }
      }
 else {
        if (DEBUG) {
          System.out.println("String_Node_Str" + isScheduled + "String_Node_Str");
        }
      }
    }
  finally {
      flushLock.unlock();
    }
  }
  return flushedSomeRecords;
}