Program: 113415
Project: 113415
Buggy source:
protected static <C,R extends Message>R syncCall(SERVICES service,UserCredentials userCreds,Auth auth,Options options,UUIDResolver uuidResolver,UUIDIterator it,boolean uuidIteratorHasAddresses,boolean delayNextTry,int maxRetries,C callRequest,ReusableBuffer buffer,CallGenerator<C,R> callGen) throws PosixErrorException, IOException, InternalServerErrorException, AddressToUUIDNotFoundException {
  int maxTries=maxRetries;
  int attempt=0;
  R response=null;
  try {
    while (++attempt <= maxTries || maxTries == 0) {
      RPCResponse<R> r=null;
      try {
        InetSocketAddress server;
        if (uuidIteratorHasAddresses) {
          server=getInetSocketAddressFromAddress(it.getUUID(),service);
        }
 else {
          String address=uuidResolver.uuidToAddress(it.getUUID());
          server=getInetSocketAddressFromAddress(address,service);
        }
        r=callGen.executeCall(server,auth,userCreds,callRequest);
        response=r.get();
        if (r.getData() != null) {
          if (buffer != null) {
            buffer.put(r.getData());
          }
          BufferPool.free(r.getData());
        }
      }
 catch (      PBRPCException pbe) {
        if (pbe.getErrorType().equals(ErrorType.REDIRECT)) {
          assert(pbe.getRedirectToServerUUID() != null);
          if (Logging.isInfo()) {
            String error;
            if (uuidIteratorHasAddresses) {
              error="String_Node_Str" + it.getUUID() + "String_Node_Str"+ pbe.getRedirectToServerUUID()+ "String_Node_Str"+ attempt;
            }
 else {
              error="String_Node_Str" + it.getUUID() + "String_Node_Str"+ pbe.getRedirectToServerUUID()+ "String_Node_Str"+ attempt;
            }
            Logging.logMessage(Logging.LEVEL_INFO,Category.misc,pbe,error);
          }
          if (maxTries != 0 && attempt == maxTries) {
            maxTries++;
          }
          it.markUUIDAsFailed(it.getUUID());
          continue;
        }
        if (((attempt < maxTries || maxTries == 0) || (attempt == maxTries && delayNextTry)) && (pbe.getErrorType().equals(ErrorType.IO_ERROR) || pbe.getErrorType().equals(ErrorType.INTERNAL_SERVER_ERROR))) {
          if (attempt == 1 && maxTries != 1) {
            String retriesLeft=(maxTries == 0) ? ("String_Node_Str") : (String.valueOf(maxTries - attempt));
            Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,pbe,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",it.getUUID(),retriesLeft,options.getRetryDelay_s());
          }
          it.markUUIDAsFailed(it.getUUID());
        }
 else {
          throw pbe;
        }
      }
catch (      IOException ioe) {
        if (((attempt < maxTries || maxTries == 0) || (attempt == maxTries && delayNextTry))) {
          if (attempt == 1 && maxTries != 1) {
            String retriesLeft=(maxTries == 0) ? ("String_Node_Str") : (String.valueOf(maxTries - attempt));
            Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,ioe,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",it.getUUID(),retriesLeft,options.getRetryDelay_s(),ioe.getMessage());
            if (Logging.isDebug()) {
              Logging.logError(Logging.LEVEL_DEBUG,null,ioe);
            }
          }
          it.markUUIDAsFailed(it.getUUID());
          continue;
        }
 else {
          throw ioe;
        }
      }
catch (      InterruptedException ie) {
        if (options.getInterruptSignal() == 0) {
          if (Logging.isDebug()) {
            Logging.logMessage(Logging.LEVEL_DEBUG,Category.misc,ie,"String_Node_Str");
          }
          break;
        }
        throw new IOException();
      }
 finally {
        if (r != null) {
          r.freeBuffers();
        }
      }
      return response;
    }
  }
 catch (  PBRPCException e) {
    handleErrorAfterMaxTriesExceeded(e,it);
  }
  return null;
}

Fixed version (ground truth):
protected static <C,R extends Message>R syncCall(SERVICES service,UserCredentials userCreds,Auth auth,Options options,UUIDResolver uuidResolver,UUIDIterator it,boolean uuidIteratorHasAddresses,boolean delayNextTry,int maxRetries,C callRequest,ReusableBuffer buffer,CallGenerator<C,R> callGen) throws PosixErrorException, IOException, InternalServerErrorException, AddressToUUIDNotFoundException {
  int maxTries=maxRetries;
  int attempt=0;
  R response=null;
  try {
    while (++attempt <= maxTries || maxTries == 0) {
      RPCResponse<R> r=null;
      try {
        InetSocketAddress server;
        if (uuidIteratorHasAddresses) {
          server=getInetSocketAddressFromAddress(it.getUUID(),service);
        }
 else {
          String address=uuidResolver.uuidToAddress(it.getUUID());
          server=getInetSocketAddressFromAddress(address,service);
        }
        r=callGen.executeCall(server,auth,userCreds,callRequest);
        response=r.get();
        if (r.getData() != null) {
          if (buffer != null) {
            buffer.put(r.getData());
          }
          BufferPool.free(r.getData());
        }
      }
 catch (      PBRPCException pbe) {
        if (pbe.getErrorType().equals(ErrorType.REDIRECT)) {
          assert(pbe.getRedirectToServerUUID() != null);
          if (Logging.isInfo()) {
            String error;
            if (uuidIteratorHasAddresses) {
              error="String_Node_Str" + it.getUUID() + "String_Node_Str"+ pbe.getRedirectToServerUUID()+ "String_Node_Str"+ attempt;
            }
 else {
              error="String_Node_Str" + it.getUUID() + "String_Node_Str"+ pbe.getRedirectToServerUUID()+ "String_Node_Str"+ attempt;
            }
            Logging.logMessage(Logging.LEVEL_INFO,Category.misc,pbe,error);
          }
          if (maxTries != 0 && attempt == maxTries) {
            maxTries++;
          }
          it.markUUIDAsFailed(it.getUUID());
          continue;
        }
        if (((attempt < maxTries || maxTries == 0) || (attempt == maxTries && delayNextTry)) && (pbe.getErrorType().equals(ErrorType.IO_ERROR) || pbe.getErrorType().equals(ErrorType.INTERNAL_SERVER_ERROR))) {
          if (attempt == 1 && maxTries != 1) {
            String retriesLeft=(maxTries == 0) ? ("String_Node_Str") : (String.valueOf(maxTries - attempt));
            Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,pbe,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",it.getUUID(),retriesLeft,options.getRetryDelay_s());
          }
          it.markUUIDAsFailed(it.getUUID());
          continue;
        }
 else {
          throw pbe;
        }
      }
catch (      IOException ioe) {
        if (((attempt < maxTries || maxTries == 0) || (attempt == maxTries && delayNextTry))) {
          if (attempt == 1 && maxTries != 1) {
            String retriesLeft=(maxTries == 0) ? ("String_Node_Str") : (String.valueOf(maxTries - attempt));
            Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,ioe,"String_Node_Str" + "String_Node_Str" + "String_Node_Str",it.getUUID(),retriesLeft,options.getRetryDelay_s(),ioe.getMessage());
            if (Logging.isDebug()) {
              Logging.logError(Logging.LEVEL_DEBUG,null,ioe);
            }
          }
          it.markUUIDAsFailed(it.getUUID());
          continue;
        }
 else {
          throw ioe;
        }
      }
catch (      InterruptedException ie) {
        if (options.getInterruptSignal() == 0) {
          if (Logging.isDebug()) {
            Logging.logMessage(Logging.LEVEL_DEBUG,Category.misc,ie,"String_Node_Str");
          }
          break;
        }
        throw new IOException();
      }
 finally {
        if (r != null) {
          r.freeBuffers();
        }
      }
      return response;
    }
  }
 catch (  PBRPCException e) {
    handleErrorAfterMaxTriesExceeded(e,it);
  }
  return null;
}