Program: 138699
Project: 138699
Buggy source:
/** 
 * Method "clearDependencies" is to be used before a file is deleted. The root element is given as argument and the dependencies on this element are removed in all resources that depend on this element.
 * @param elementToDelete a root element which file will be deleted.
 * @return the list of modified dependencies
 */
public List<Resource> clearDependencies(ModelElement elementToDelete){
  EList<Dependency> clientDependencies;
  clientDependencies=elementToDelete.getClientDependency();
  List<Resource> modifiedResources=new ArrayList<Resource>();
  Iterator<Dependency> it=clientDependencies.iterator();
  while (it.hasNext()) {
    Dependency dependency=(Dependency)it.next();
    if (dependency.eIsProxy()) {
      dependency=(Dependency)EObjectHelper.resolveObject(dependency);
      EList<ModelElement> client=dependency.getClient();
      Iterator<ModelElement> iterator=client.iterator();
      while (iterator.hasNext()) {
        ModelElement modelElement=iterator.next();
        if (modelElement.getName().equals(elementToDelete.getName())) {
          iterator.remove();
          if (client.size() == 0)           it.remove();
        }
      }
    }
    Resource dependencyResource=dependency.eResource();
    if (dependencyResource != null) {
      modifiedResources.add(dependencyResource);
    }
  }
  clientDependencies.clear();
  EList<Dependency> supplierDependencies=elementToDelete.getSupplierDependency();
  for (  Dependency dependency : supplierDependencies) {
    EList<ModelElement> client=dependency.getClient();
    for (    ModelElement modelElement : client) {
      Resource clientResource=modelElement.eResource();
      if (clientResource != null) {
        modifiedResources.add(clientResource);
      }
    }
    client.clear();
  }
  return modifiedResources;
}

Fixed version (ground truth):
/** 
 * Method "clearDependencies" is to be used before a file is deleted. The root element is given as argument and the dependencies on this element are removed in all resources that depend on this element.
 * @param elementToDelete a root element which file will be deleted.
 * @return the list of modified dependencies
 */
public List<Resource> clearDependencies(ModelElement elementToDelete){
  EList<Dependency> clientDependencies;
  clientDependencies=elementToDelete.getClientDependency();
  List<Resource> modifiedResources=new ArrayList<Resource>();
  Iterator<Dependency> it=clientDependencies.iterator();
  while (it.hasNext()) {
    Dependency dependency=(Dependency)it.next();
    if (dependency.eIsProxy()) {
      dependency=(Dependency)EObjectHelper.resolveObject(dependency);
    }
    Resource dependencyResource=dependency.eResource();
    if (dependencyResource != null) {
      modifiedResources.add(dependencyResource);
    }
  }
  clientDependencies.clear();
  EList<Dependency> supplierDependencies=elementToDelete.getSupplierDependency();
  for (  Dependency dependency : supplierDependencies) {
    EList<ModelElement> client=dependency.getClient();
    for (    ModelElement modelElement : client) {
      Resource clientResource=modelElement.eResource();
      if (clientResource != null) {
        modifiedResources.add(clientResource);
      }
    }
    client.clear();
  }
  return modifiedResources;
}