Program: 48934
Project: 48934
Buggy source:
private Object waitForResponse(long time,TimeUnit unit){
  long timeout=unit.toMillis(time);
  if (timeout < 0)   timeout=0;
  final long maxCallTimeout=callTimeout * 2 > 0 ? callTimeout * 2 : Long.MAX_VALUE;
  final boolean longPolling=timeout > maxCallTimeout;
  int pollCount=0;
  InterruptedException interrupted=null;
  while (timeout >= 0) {
    final long pollTimeout=Math.min(maxCallTimeout,timeout);
    final long start=Clock.currentTimeMillis();
    final Object response;
    final long lastPollTime;
    try {
      response=responseQ.poll(pollTimeout,TimeUnit.MILLISECONDS);
      lastPollTime=Clock.currentTimeMillis() - start;
      timeout=decrementTimeout(timeout,lastPollTime);
    }
 catch (    InterruptedException e) {
      logger.finest(Thread.currentThread().getName() + "String_Node_Str" + "String_Node_Str"+ op);
      interrupted=e;
      if (!nodeEngine.isActive()) {
        return e;
      }
      continue;
    }
    pollCount++;
    if (response == RETRY_RESPONSE) {
      if (interrupted != null) {
        return interrupted;
      }
      if (timeout > 0) {
        if (invokeCount > 5) {
          final long sleepTime=tryPauseMillis;
          try {
            Thread.sleep(sleepTime);
            timeout=decrementTimeout(timeout,sleepTime);
          }
 catch (          InterruptedException e) {
            return e;
          }
        }
        doInvoke();
      }
 else {
        return TIMEOUT_RESPONSE;
      }
    }
 else     if (response == WAIT_RESPONSE) {
      continue;
    }
 else     if (response != null) {
      return response;
    }
 else     if (longPolling) {
      final Address target=getTarget();
      if (nodeEngine.getThisAddress().equals(target)) {
        continue;
      }
      logger.warning("String_Node_Str" + lastPollTime + "String_Node_Str"+ toString());
      boolean executing=isOperationExecuting(target);
      if (!executing) {
        Object obj=responseQ.peek();
        if (obj != null) {
          continue;
        }
        return new OperationTimeoutException("String_Node_Str" + (pollTimeout * pollCount) + "String_Node_Str"+ toString());
      }
    }
  }
  return TIMEOUT_RESPONSE;
}

Fixed version (ground truth):
private Object waitForResponse(long time,TimeUnit unit){
  long timeout=unit.toMillis(time);
  if (timeout < 0)   timeout=0;
  final long maxCallTimeout=callTimeout * 2 > 0 ? callTimeout * 2 : Long.MAX_VALUE;
  final boolean longPolling=timeout > maxCallTimeout;
  int pollCount=0;
  InterruptedException interrupted=null;
  while (timeout >= 0) {
    final long pollTimeout=Math.min(maxCallTimeout,timeout);
    final long start=Clock.currentTimeMillis();
    final Object response;
    final long lastPollTime;
    try {
      response=responseQ.poll(pollTimeout,TimeUnit.MILLISECONDS);
      lastPollTime=Clock.currentTimeMillis() - start;
      timeout=decrementTimeout(timeout,lastPollTime);
    }
 catch (    InterruptedException e) {
      logger.finest(Thread.currentThread().getName() + "String_Node_Str" + "String_Node_Str"+ op);
      interrupted=e;
      if (!nodeEngine.isActive()) {
        return e;
      }
      continue;
    }
    pollCount++;
    if (response == RETRY_RESPONSE) {
      if (interrupted != null) {
        return interrupted;
      }
      if (timeout > 0) {
        if (invokeCount > 5) {
          final long sleepTime=tryPauseMillis;
          try {
            Thread.sleep(sleepTime);
            timeout=decrementTimeout(timeout,sleepTime);
          }
 catch (          InterruptedException e) {
            return e;
          }
        }
        doInvoke();
      }
 else {
        return TIMEOUT_RESPONSE;
      }
    }
 else     if (response == WAIT_RESPONSE) {
      continue;
    }
 else     if (response != null) {
      if (interrupted != null) {
        Thread.currentThread().interrupt();
      }
      return response;
    }
 else     if (longPolling) {
      final Address target=getTarget();
      if (nodeEngine.getThisAddress().equals(target)) {
        continue;
      }
      logger.warning("String_Node_Str" + lastPollTime + "String_Node_Str"+ toString());
      boolean executing=isOperationExecuting(target);
      if (!executing) {
        Object obj=responseQ.peek();
        if (obj != null) {
          continue;
        }
        return new OperationTimeoutException("String_Node_Str" + (pollTimeout * pollCount) + "String_Node_Str"+ toString());
      }
    }
  }
  return TIMEOUT_RESPONSE;
}