Program: 129586
Project: 129586
Buggy source:
public void propagateFileName(Property lastVersionProperty,Property resourceProperty) throws PersistenceException {
  ResourceFilenameHelper.FileName fileNameTest=ResourceFilenameHelper.create(resourceProperty.eResource(),resourceProperty,lastVersionProperty);
  if (!ResourceFilenameHelper.mustChangeVersion(fileNameTest) && !ResourceFilenameHelper.mustChangeLabel(fileNameTest)) {
    return;
  }
  List<Resource> affectedResources=getAffectedResources(resourceProperty);
  List<Resource> resourcesToSave=new ArrayList<Resource>();
  Property previousVersionProperty=null;
  IFile propertyFile=null;
  for (  Resource resource : affectedResources) {
    ResourceFilenameHelper.FileName fileName=ResourceFilenameHelper.create(resource,resourceProperty,lastVersionProperty);
    if (ResourceFilenameHelper.mustChangeVersion(fileName)) {
      IPath path=URIHelper.convert(resource.getURI());
      IPath bakPath=path.addFileExtension("String_Node_Str");
      copyResource(resource,bakPath);
      IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(bakPath);
      moveResource(resource,ResourceFilenameHelper.getExpectedFilePath(fileName,false));
      resourcesToSave.add(resource);
      ResourceUtils.moveResource(file,path);
      file=ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (isPropertyFile(file)) {
        propertyFile=file;
      }
    }
 else     if (ResourceFilenameHelper.mustChangeLabel(fileName)) {
      resourceProperty.setLabel(lastVersionProperty.getLabel());
      if (!ResourceFilenameHelper.hasSameNameButDifferentCase(fileName)) {
        moveResource(resource,ResourceFilenameHelper.getExpectedFilePath(fileName,false));
      }
      resourcesToSave.add(resource);
    }
  }
  if (propertyFile != null) {
    previousVersionProperty=loadProperty(propertyFile);
  }
  if (previousVersionProperty != null) {
    List<Resource> previousVersionResources=getAffectedResources(previousVersionProperty);
    for (    Resource resource : previousVersionResources) {
      FileName fileName=ResourceFilenameHelper.create(resource,previousVersionProperty,lastVersionProperty);
      if (ResourceFilenameHelper.mustChangeLabel(fileName)) {
        IPath expectedFilePath=ResourceFilenameHelper.getExpectedFilePath(fileName,true);
        previousVersionProperty.setLabel(lastVersionProperty.getLabel());
        if (!ResourceFilenameHelper.hasSameNameButDifferentCase(fileName)) {
          moveResource(resource,expectedFilePath);
        }
      }
      resourcesToSave.add(resource);
    }
    if (lastVersionProperty.getItem().getParent() instanceof FolderItem) {
      FolderItem folderItem=(FolderItem)lastVersionProperty.getItem().getParent();
      folderItem.getChildren().add(previousVersionProperty.getItem());
    }
  }
  for (  Resource resource : resourcesToSave) {
    saveResource(resource);
  }
  if (!resourceProperty.equals(lastVersionProperty)) {
    Item item=resourceProperty.getItem();
    if (item.getParent() != null && item.getParent() instanceof FolderItem) {
      ((FolderItem)item.getParent()).getChildren().remove(item);
      item.setParent(null);
    }
  }
}

Fixed version (ground truth):
public void propagateFileName(Property lastVersionProperty,Property resourceProperty) throws PersistenceException {
  ResourceFilenameHelper.FileName fileNameTest=ResourceFilenameHelper.create(resourceProperty.eResource(),resourceProperty,lastVersionProperty);
  if (!ResourceFilenameHelper.mustChangeVersion(fileNameTest) && !ResourceFilenameHelper.mustChangeLabel(fileNameTest)) {
    return;
  }
  List<Resource> affectedResources=getAffectedResources(resourceProperty);
  List<Resource> resourcesToSave=new ArrayList<Resource>();
  Property previousVersionProperty=null;
  IFile propertyFile=null;
  for (  Resource resource : affectedResources) {
    ResourceFilenameHelper.FileName fileName=ResourceFilenameHelper.create(resource,resourceProperty,lastVersionProperty);
    if (ResourceFilenameHelper.mustChangeVersion(fileName)) {
      IPath path=URIHelper.convert(resource.getURI());
      IPath bakPath=path.addFileExtension("String_Node_Str");
      copyResource(resource,bakPath);
      IFile file=ResourcesPlugin.getWorkspace().getRoot().getFile(bakPath);
      moveResource(resource,ResourceFilenameHelper.getExpectedFilePath(fileName,false));
      resourcesToSave.add(resource);
      ResourceUtils.moveResource(file,path);
      file=ResourcesPlugin.getWorkspace().getRoot().getFile(path);
      if (isPropertyFile(file)) {
        propertyFile=file;
      }
    }
 else     if (ResourceFilenameHelper.mustChangeLabel(fileName)) {
      resourceProperty.setLabel(lastVersionProperty.getLabel());
      if (!ResourceFilenameHelper.hasSameNameButDifferentCase(fileName)) {
        moveResource(resource,ResourceFilenameHelper.getExpectedFilePath(fileName,false));
      }
      resourcesToSave.add(resource);
    }
  }
  if (propertyFile != null) {
    previousVersionProperty=loadProperty(propertyFile);
  }
  if (previousVersionProperty != null) {
    List<Resource> previousVersionResources=getAffectedResources(previousVersionProperty);
    for (    Resource resource : previousVersionResources) {
      FileName fileName=ResourceFilenameHelper.create(resource,previousVersionProperty,lastVersionProperty);
      if (ResourceFilenameHelper.mustChangeLabel(fileName)) {
        IPath expectedFilePath=ResourceFilenameHelper.getExpectedFilePath(fileName,true);
        previousVersionProperty.setLabel(lastVersionProperty.getLabel());
        if (!ResourceFilenameHelper.hasSameNameButDifferentCase(fileName)) {
          moveResource(resource,expectedFilePath);
        }
      }
      resourcesToSave.add(resource);
    }
    if (lastVersionProperty.getItem().getParent() instanceof FolderItem) {
      FolderItem folderItem=(FolderItem)lastVersionProperty.getItem().getParent();
      folderItem.getChildren().add(previousVersionProperty.getItem());
    }
  }
  for (  Resource resource : resourcesToSave) {
    if (ResourceFilenameHelper.mustChangeLabel(fileNameTest) && resource.getURI() != null && resource.getURI().toString().endsWith("String_Node_Str")) {
      continue;
    }
    saveResource(resource);
  }
  if (!resourceProperty.equals(lastVersionProperty)) {
    Item item=resourceProperty.getItem();
    if (item.getParent() != null && item.getParent() instanceof FolderItem) {
      ((FolderItem)item.getParent()).getChildren().remove(item);
      item.setParent(null);
    }
  }
}