Program: 70068
Project: 70068
Buggy source:
public void obtainBindingData(LogicalData ld,DataLocation source,DataLocation target,LogicalData tgtData,Transferable reason,EventListener listener){
  BindingObject tgtBO=((BindingObjectLocation)target).getBindingObject();
  ld.lockHostRemoval();
  Collection<Copy> copiesInProgress=ld.getCopiesInProgress();
  if (copiesInProgress != null && !copiesInProgress.isEmpty()) {
    for (    Copy copy : copiesInProgress) {
      if (copy != null) {
        if (copy.getTargetLoc() != null && copy.getTargetLoc().getHosts().contains(Comm.getAppHost())) {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
          }
          waitForCopyTofinish(copy);
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ copy.getFinalTarget()+ "String_Node_Str"+ tgtBO.getName());
          }
          BindingObject bo=BindingObject.generate(copy.getFinalTarget());
          if (ld.getName().equals(tgtBO.getName())) {
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
 else {
            LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
            BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
            if (tgtData != null) {
              tgtData.addLocation(target);
            }
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
          listener.notifyEnd(null);
          ld.releaseHostRemoval();
          return;
        }
 else         if (copy.getTargetData() != null && copy.getTargetData().getAllHosts().contains(Comm.getAppHost())) {
          waitForCopyTofinish(copy);
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ copy.getFinalTarget()+ "String_Node_Str"+ tgtBO.getName());
          }
          BindingObject bo=BindingObject.generate(copy.getFinalTarget());
          if (ld.getName().equals(tgtBO.getName())) {
            LOGGER.debug("String_Node_Str" + bo.getName());
            reason.setDataTarget(copy.getFinalTarget());
          }
 else {
            LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
            BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
            if (tgtData != null) {
              tgtData.addLocation(target);
            }
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
          listener.notifyEnd(null);
          ld.releaseHostRemoval();
          return;
        }
 else {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
          }
        }
      }
    }
  }
  if (DEBUG) {
    LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ Comm.getAppHost().getName()+ "String_Node_Str");
  }
  for (  MultiURI u : ld.getURIs()) {
    if (DEBUG) {
      String hostname=(u.getHost() != null) ? u.getHost().getName() : "String_Node_Str";
      LOGGER.debug(ld.getName() + "String_Node_Str" + u.toString()+ "String_Node_Str"+ hostname+ "String_Node_Str");
    }
    if (u.getHost() == Comm.getAppHost()) {
      if (DEBUG) {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ u.getHost().getName()+ "String_Node_Str"+ tgtBO.getName());
      }
      BindingObject bo=BindingObject.generate(u.getPath());
      if (ld.getName().equals(tgtBO.getName())) {
        LOGGER.debug("String_Node_Str" + u.getPath());
        reason.setDataTarget(u.getPath());
      }
 else {
        LOGGER.debug("String_Node_Str" + u.getPath() + "String_Node_Str"+ tgtBO.getName());
        BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
        if (tgtData != null) {
          tgtData.addLocation(target);
        }
        LOGGER.debug("String_Node_Str" + u.getPath());
        reason.setDataTarget(u.getPath());
      }
      listener.notifyEnd(null);
      ld.releaseHostRemoval();
      return;
    }
 else {
      if (DEBUG) {
        String hostname=(u.getHost() != null) ? u.getHost().getName() : "String_Node_Str";
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ hostname+ "String_Node_Str");
      }
    }
  }
  if (source != null) {
    for (    Resource sourceRes : source.getHosts()) {
      COMPSsNode node=sourceRes.getNode();
      String sourcePath=source.getURIInHost(sourceRes).getPath();
      if (node != this) {
        try {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourcePath+ "String_Node_Str"+ tgtBO.getName());
          }
          node.sendData(ld,source,target,tgtData,reason,listener);
        }
 catch (        Exception e) {
          ErrorManager.warn("String_Node_Str" + tgtBO.getName(),e);
          continue;
        }
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
        ld.releaseHostRemoval();
        return;
      }
 else {
        BindingObject bo=BindingObject.generate(sourcePath);
        if (ld.getName().equals(tgtBO.getName())) {
          LOGGER.debug("String_Node_Str" + bo.getName());
          reason.setDataTarget(sourcePath);
        }
 else {
          LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
          BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
          if (tgtData != null) {
            tgtData.addLocation(target);
          }
          LOGGER.debug("String_Node_Str" + tgtBO.getName());
          reason.setDataTarget(sourcePath);
        }
        listener.notifyEnd(null);
        ld.releaseHostRemoval();
        return;
      }
    }
  }
 else {
    LOGGER.debug("String_Node_Str");
  }
  for (  Resource sourceRes : ld.getAllHosts()) {
    COMPSsNode node=sourceRes.getNode();
    if (node != this) {
      try {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourceRes.getName()+ "String_Node_Str"+ tgtBO.getName());
        node.sendData(ld,source,target,tgtData,reason,listener);
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
        continue;
      }
      LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
      ld.releaseHostRemoval();
      return;
    }
 else {
      if (DEBUG) {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourceRes.getName()+ "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public void obtainBindingData(LogicalData ld,DataLocation source,DataLocation target,LogicalData tgtData,Transferable reason,EventListener listener){
  BindingObject tgtBO=((BindingObjectLocation)target).getBindingObject();
  ld.lockHostRemoval();
  Collection<Copy> copiesInProgress=ld.getCopiesInProgress();
  if (copiesInProgress != null && !copiesInProgress.isEmpty()) {
    for (    Copy copy : copiesInProgress) {
      if (copy != null) {
        if (copy.getTargetLoc() != null && copy.getTargetLoc().getHosts().contains(Comm.getAppHost())) {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
          }
          Copy.waitForCopyTofinish(copy,this);
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ copy.getFinalTarget()+ "String_Node_Str"+ tgtBO.getName());
          }
          BindingObject bo=BindingObject.generate(copy.getFinalTarget());
          if (ld.getName().equals(tgtBO.getName())) {
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
 else {
            LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
            BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
            if (tgtData != null) {
              tgtData.addLocation(target);
            }
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
          listener.notifyEnd(null);
          ld.releaseHostRemoval();
          return;
        }
 else         if (copy.getTargetData() != null && copy.getTargetData().getAllHosts().contains(Comm.getAppHost())) {
          Copy.waitForCopyTofinish(copy,this);
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ copy.getFinalTarget()+ "String_Node_Str"+ tgtBO.getName());
          }
          BindingObject bo=BindingObject.generate(copy.getFinalTarget());
          if (ld.getName().equals(tgtBO.getName())) {
            LOGGER.debug("String_Node_Str" + bo.getName());
            reason.setDataTarget(copy.getFinalTarget());
          }
 else {
            LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
            BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
            if (tgtData != null) {
              tgtData.addLocation(target);
            }
            LOGGER.debug("String_Node_Str" + copy.getFinalTarget());
            reason.setDataTarget(copy.getFinalTarget());
          }
          listener.notifyEnd(null);
          ld.releaseHostRemoval();
          return;
        }
 else {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
          }
        }
      }
    }
  }
  if (DEBUG) {
    LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ Comm.getAppHost().getName()+ "String_Node_Str");
  }
  for (  MultiURI u : ld.getURIs()) {
    if (DEBUG) {
      String hostname=(u.getHost() != null) ? u.getHost().getName() : "String_Node_Str";
      LOGGER.debug(ld.getName() + "String_Node_Str" + u.toString()+ "String_Node_Str"+ hostname+ "String_Node_Str");
    }
    if (u.getHost() == Comm.getAppHost()) {
      if (DEBUG) {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ u.getHost().getName()+ "String_Node_Str"+ tgtBO.getName());
      }
      BindingObject bo=BindingObject.generate(u.getPath());
      if (ld.getName().equals(tgtBO.getName())) {
        LOGGER.debug("String_Node_Str" + u.getPath());
        reason.setDataTarget(u.getPath());
      }
 else {
        LOGGER.debug("String_Node_Str" + u.getPath() + "String_Node_Str"+ tgtBO.getName());
        BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
        if (tgtData != null) {
          tgtData.addLocation(target);
        }
        LOGGER.debug("String_Node_Str" + u.getPath());
        reason.setDataTarget(u.getPath());
      }
      listener.notifyEnd(null);
      ld.releaseHostRemoval();
      return;
    }
 else {
      if (DEBUG) {
        String hostname=(u.getHost() != null) ? u.getHost().getName() : "String_Node_Str";
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ hostname+ "String_Node_Str");
      }
    }
  }
  if (source != null) {
    for (    Resource sourceRes : source.getHosts()) {
      COMPSsNode node=sourceRes.getNode();
      String sourcePath=source.getURIInHost(sourceRes).getPath();
      if (node != this) {
        try {
          if (DEBUG) {
            LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourcePath+ "String_Node_Str"+ tgtBO.getName());
          }
          node.sendData(ld,source,target,tgtData,reason,listener);
        }
 catch (        Exception e) {
          ErrorManager.warn("String_Node_Str" + tgtBO.getName(),e);
          continue;
        }
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
        ld.releaseHostRemoval();
        return;
      }
 else {
        BindingObject bo=BindingObject.generate(sourcePath);
        if (ld.getName().equals(tgtBO.getName())) {
          LOGGER.debug("String_Node_Str" + bo.getName());
          reason.setDataTarget(sourcePath);
        }
 else {
          LOGGER.debug("String_Node_Str" + bo.getName() + "String_Node_Str"+ tgtBO.getName());
          BindingDataManager.copyCachedData(bo.getName(),tgtBO.getName());
          if (tgtData != null) {
            tgtData.addLocation(target);
          }
          LOGGER.debug("String_Node_Str" + tgtBO.getName());
          reason.setDataTarget(sourcePath);
        }
        listener.notifyEnd(null);
        ld.releaseHostRemoval();
        return;
      }
    }
  }
 else {
    LOGGER.debug("String_Node_Str");
  }
  for (  Resource sourceRes : ld.getAllHosts()) {
    COMPSsNode node=sourceRes.getNode();
    if (node != this) {
      try {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourceRes.getName()+ "String_Node_Str"+ tgtBO.getName());
        node.sendData(ld,source,target,tgtData,reason,listener);
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
        continue;
      }
      LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str");
      ld.releaseHostRemoval();
      return;
    }
 else {
      if (DEBUG) {
        LOGGER.debug("String_Node_Str" + ld.getName() + "String_Node_Str"+ sourceRes.getName()+ "String_Node_Str");
      }
    }
  }
}