Program: 70253
Project: 70253
Buggy source:
private CloudMethodWorker prepareNewResource(VM vm) throws Exception {
  CloudMethodResourceDescription granted=vm.getDescription();
  CloudImageDescription cid=granted.getImage();
  HashMap<String,String> workerProperties=cid.getProperties();
  String user=cid.getConfig().getUser();
  String password=workerProperties.get(ITConstants.PASSWORD);
  try {
    operations.configureAccess(granted.getName(),user,password);
  }
 catch (  ConnectorException e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str",e);
    throw e;
  }
  try {
    operations.prepareMachine(granted.getName(),cid);
  }
 catch (  ConnectorException e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    throw e;
  }
  CloudMethodWorker worker;
  MethodConfiguration mc=new MethodConfiguration(cid.getConfig());
  try {
    int limitOfTasks=mc.getLimitOfTasks();
    int computingUnits=granted.getTotalComputingUnits();
    if (limitOfTasks < 0 && computingUnits < 0) {
      mc.setLimitOfTasks(0);
    }
 else {
      mc.setLimitOfTasks(Math.max(limitOfTasks,computingUnits));
    }
    worker=new CloudMethodWorker(granted.getName(),granted,mc);
    worker.start(cid.getSharedDisks());
  }
 catch (  Exception e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str");
    throw new Exception("String_Node_Str",e);
  }
  try {
    worker.announceCreation();
  }
 catch (  Exception e) {
    Semaphore sem=new Semaphore(0);
    ShutdownListener sl=new ShutdownListener(sem);
    worker.stop(sl);
    runtimeLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    sl.enable();
    try {
      sem.acquire();
    }
 catch (    Exception e2) {
      resourceLogger.error("String_Node_Str",e2);
    }
    runtimeLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str");
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str",e);
    throw e;
  }
  if (operations.getTerminate()) {
    resourceLogger.info("String_Node_Str" + granted.getName() + "String_Node_Str");
    try {
      worker.announceDestruction();
    }
 catch (    Exception e) {
      resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    }
    Semaphore sem=new Semaphore(0);
    ShutdownListener sl=new ShutdownListener(sem);
    worker.stop(sl);
    sl.enable();
    try {
      sem.acquire();
    }
 catch (    Exception e) {
      resourceLogger.error("String_Node_Str");
    }
    throw new Exception("String_Node_Str");
  }
  for (  java.util.Map.Entry<String,String> disk : cid.getSharedDisks().entrySet()) {
    String diskName=disk.getKey();
    String mounpoint=disk.getValue();
    worker.addSharedDisk(diskName,mounpoint);
  }
  return worker;
}

Fixed version (ground truth):
private CloudMethodWorker prepareNewResource(VM vm) throws Exception {
  CloudMethodResourceDescription granted=vm.getDescription();
  CloudImageDescription cid=granted.getImage();
  HashMap<String,String> workerProperties=cid.getProperties();
  String user=cid.getConfig().getUser();
  String password=workerProperties.get(ITConstants.PASSWORD);
  try {
    operations.configureAccess(granted.getName(),user,password);
  }
 catch (  ConnectorException e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str",e);
    throw e;
  }
  try {
    operations.prepareMachine(granted.getName(),cid);
  }
 catch (  ConnectorException e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    throw e;
  }
  CloudMethodWorker worker;
  MethodConfiguration mc=new MethodConfiguration(cid.getConfig());
  try {
    int limitOfTasks=mc.getLimitOfTasks();
    int computingUnits=granted.getTotalComputingUnits();
    if (limitOfTasks < 0 && computingUnits < 0) {
      mc.setLimitOfTasks(0);
    }
 else {
      mc.setLimitOfTasks(Math.max(limitOfTasks,computingUnits));
    }
    worker=new CloudMethodWorker(granted.getName(),granted,mc,cid.getSharedDisks());
    worker.start();
  }
 catch (  Exception e) {
    runtimeLogger.error("String_Node_Str" + granted.getName(),e);
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str");
    throw new Exception("String_Node_Str",e);
  }
  try {
    worker.announceCreation();
  }
 catch (  Exception e) {
    Semaphore sem=new Semaphore(0);
    ShutdownListener sl=new ShutdownListener(sem);
    worker.stop(sl);
    runtimeLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    sl.enable();
    try {
      sem.acquire();
    }
 catch (    Exception e2) {
      resourceLogger.error("String_Node_Str",e2);
    }
    runtimeLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str");
    resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str"+ provider+ "String_Node_Str",e);
    throw e;
  }
  if (operations.getTerminate()) {
    resourceLogger.info("String_Node_Str" + granted.getName() + "String_Node_Str");
    try {
      worker.announceDestruction();
    }
 catch (    Exception e) {
      resourceLogger.error("String_Node_Str" + granted.getName() + "String_Node_Str",e);
    }
    Semaphore sem=new Semaphore(0);
    ShutdownListener sl=new ShutdownListener(sem);
    worker.stop(sl);
    sl.enable();
    try {
      sem.acquire();
    }
 catch (    Exception e) {
      resourceLogger.error("String_Node_Str");
    }
    throw new Exception("String_Node_Str");
  }
  return worker;
}