Program: 6819
Project: 6819
Buggy source:
private void restartInstances(HttpResponder responder,String serviceName,int instanceId,boolean restartAll){
  long startTimeMs=System.currentTimeMillis();
  boolean isSuccess=true;
  if (!serviceManagementMap.containsKey(serviceName)) {
    responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",serviceName));
    return;
  }
  MasterServiceManager masterServiceManager=serviceManagementMap.get(serviceName);
  try {
    if (!masterServiceManager.isServiceEnabled()) {
      throw new IllegalStateException();
    }
    if (restartAll) {
      masterServiceManager.restartAllInstances();
    }
 else {
      if (instanceId < 0 || instanceId >= masterServiceManager.getInstances()) {
        throw new IllegalArgumentException();
      }
      masterServiceManager.restartInstances(instanceId);
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  IllegalStateException ise) {
    LOG.debug(String.format("String_Node_Str",serviceName));
    isSuccess=false;
    responder.sendString(HttpResponseStatus.FORBIDDEN,String.format("String_Node_Str" + "String_Node_Str",serviceName));
  }
catch (  IllegalArgumentException iex) {
    LOG.debug(String.format("String_Node_Str",serviceName),iex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.BAD_REQUEST,String.format("String_Node_Str",instanceId,serviceName));
  }
catch (  Exception ex) {
    LOG.warn(String.format("String_Node_Str",serviceName),ex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",instanceId,serviceName));
  }
 finally {
    long endTimeMs=System.currentTimeMillis();
    if (restartAll) {
      serviceStore.setRestartAllInstancesRequest(serviceName,startTimeMs,endTimeMs,isSuccess);
    }
 else {
      serviceStore.setRestartInstanceRequest(serviceName,startTimeMs,endTimeMs,isSuccess,instanceId);
    }
  }
}

Fixed version (ground truth):
private void restartInstances(HttpResponder responder,String serviceName,int instanceId,boolean restartAll){
  long startTimeMs=System.currentTimeMillis();
  boolean isSuccess=true;
  if (!serviceManagementMap.containsKey(serviceName)) {
    responder.sendString(HttpResponseStatus.NOT_FOUND,String.format("String_Node_Str",serviceName));
    return;
  }
  MasterServiceManager masterServiceManager=serviceManagementMap.get(serviceName);
  try {
    if (!masterServiceManager.isServiceEnabled()) {
      String message=String.format("String_Node_Str",serviceName);
      LOG.debug(message);
      isSuccess=false;
      responder.sendString(HttpResponseStatus.FORBIDDEN,message);
      return;
    }
    if (restartAll) {
      masterServiceManager.restartAllInstances();
    }
 else {
      if (instanceId < 0 || instanceId >= masterServiceManager.getInstances()) {
        throw new IllegalArgumentException();
      }
      masterServiceManager.restartInstances(instanceId);
    }
    responder.sendStatus(HttpResponseStatus.OK);
  }
 catch (  IllegalStateException ise) {
    String message=String.format("String_Node_Str",serviceName);
    LOG.debug(message,ise);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.SERVICE_UNAVAILABLE,message);
  }
catch (  IllegalArgumentException iex) {
    String message=String.format("String_Node_Str",instanceId,serviceName);
    LOG.debug(message,iex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.BAD_REQUEST,message);
  }
catch (  Exception ex) {
    LOG.warn(String.format("String_Node_Str",serviceName),ex);
    isSuccess=false;
    responder.sendString(HttpResponseStatus.INTERNAL_SERVER_ERROR,String.format("String_Node_Str",instanceId,serviceName));
  }
 finally {
    long endTimeMs=System.currentTimeMillis();
    if (restartAll) {
      serviceStore.setRestartAllInstancesRequest(serviceName,startTimeMs,endTimeMs,isSuccess);
    }
 else {
      serviceStore.setRestartInstanceRequest(serviceName,startTimeMs,endTimeMs,isSuccess,instanceId);
    }
  }
}