Program: 70422
Project: 70422
Buggy source:
public void retrieveData(boolean saveUniqueData){
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  Semaphore sem=new Semaphore(0);
  SafeCopyListener listener=new SafeCopyListener(sem);
  HashSet<LogicalData> lds=getAllDataFromHost();
  HashMap<String,String> disks=SharedDiskManager.terminate(this);
  COMPSsNode masterNode=Comm.appHost.getNode();
  for (  LogicalData ld : lds) {
    ld.notifyToInProgressCopiesEnd(listener);
    DataLocation lastLoc=ld.removeHostAndCheckLocationToSave(this,disks);
    if (lastLoc != null && saveUniqueData) {
      listener.addOperation();
      DataLocation safeLoc=null;
      String safePath=Protocol.FILE_URI.getSchema() + Comm.appHost.getTempDirPath() + ld.getName();
      try {
        SimpleURI uri=new SimpleURI(safePath);
        safeLoc=DataLocation.createLocation(Comm.appHost,uri);
      }
 catch (      Exception e) {
        ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + "String_Node_Str" + safePath,e);
      }
      masterNode.obtainData(ld,lastLoc,safeLoc,ld,new SafeCopyTransferable(),listener);
    }
  }
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  listener.enable();
  try {
    sem.acquire();
  }
 catch (  InterruptedException ex) {
    logger.error("String_Node_Str" + getName() + "String_Node_Str");
  }
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  if (this.getType() != Type.SERVICE) {
    if (Tracer.isActivated()) {
      node.generatePackage();
      getTracingPackageToMaster();
      if (debug) {
        logger.debug("String_Node_Str" + this.getName());
      }
    }
    if (debug) {
      node.generateWorkersDebugInfo();
      getWorkersDebugInfo();
      logger.debug("String_Node_Str" + this.getName());
    }
  }
}

Fixed version (ground truth):
public void retrieveData(boolean saveUniqueData){
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  Semaphore sem=new Semaphore(0);
  SafeCopyListener listener=new SafeCopyListener(sem);
  HashSet<LogicalData> lds=getAllDataFromHost();
  HashMap<String,String> disks=SharedDiskManager.terminate(this);
  COMPSsNode masterNode=Comm.appHost.getNode();
  for (  LogicalData ld : lds) {
    ld.notifyToInProgressCopiesEnd(listener);
    DataLocation lastLoc=ld.removeHostAndCheckLocationToSave(this,disks);
    if (lastLoc != null && saveUniqueData) {
      listener.addOperation();
      DataLocation safeLoc=null;
      String safePath=Protocol.FILE_URI.getSchema() + Comm.appHost.getTempDirPath() + ld.getName();
      try {
        SimpleURI uri=new SimpleURI(safePath);
        safeLoc=DataLocation.createLocation(Comm.appHost,uri);
      }
 catch (      Exception e) {
        ErrorManager.error(DataLocation.ERROR_INVALID_LOCATION + "String_Node_Str" + safePath,e);
      }
      masterNode.obtainData(ld,lastLoc,safeLoc,ld,new SafeCopyTransferable(),listener);
    }
  }
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  listener.enable();
  try {
    sem.acquire();
  }
 catch (  InterruptedException ex) {
    logger.error("String_Node_Str" + getName() + "String_Node_Str");
  }
  if (debug) {
    logger.debug("String_Node_Str" + this.getName());
  }
  if (this.getType() != Type.SERVICE) {
    if (Tracer.isActivated()) {
      if (node.generatePackage()) {
        getTracingPackageToMaster();
        if (debug) {
          logger.debug("String_Node_Str" + this.getName());
        }
      }
    }
    if (debug) {
      if (node.generateWorkersDebugInfo()) {
        getWorkersDebugInfo();
        logger.debug("String_Node_Str" + this.getName());
      }
    }
  }
}