Program: 127412
Project: 127412
Buggy source:
private void testRoutinepropagateFileName(IProject project,XmiResourceManager xrm) throws PersistenceException {
  RoutineItem routineItem=createTempRoutineItem();
  Resource routineItemResource=xrm.createItemResource(project,routineItem,new Path("String_Node_Str"),ERepositoryObjectType.ROUTINES,true);
  Resource propertyResource=xrm.createPropertyResource(routineItemResource);
  routineItemResource.getContents().add(routineItem.getContent());
  propertyResource.getContents().add(routineItem.getProperty());
  propertyResource.getContents().add(routineItem.getState());
  propertyResource.getContents().add(routineItem);
  xrm.saveResource(routineItemResource);
  xrm.saveResource(propertyResource);
  routineItem.getProperty().setLabel("String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  IFile file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  Property oldProperty=xrm.loadProperty(file);
  String content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setLabel("String_Node_Str");
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  xrm.propagateFileName(routineItem.getProperty(),oldProperty);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getProperty().setLabel("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  List<Resource> resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  Property property=xrm.forceReloadProperty(routineItem.getProperty());
  resources=xrm.getAffectedResources(property);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
}

Fixed version (ground truth):
private void testRoutinepropagateFileName(IProject project,XmiResourceManager xrm) throws PersistenceException {
  RoutineItem routineItem=createTempRoutineItem();
  Resource routineItemResource=xrm.createItemResource(project,routineItem,new Path("String_Node_Str"),ERepositoryObjectType.ROUTINES,true);
  Resource propertyResource=xrm.createPropertyResource(routineItemResource);
  routineItemResource.getContents().add(routineItem.getContent());
  propertyResource.getContents().add(routineItem.getProperty());
  propertyResource.getContents().add(routineItem.getState());
  propertyResource.getContents().add(routineItem);
  xrm.saveResource(routineItemResource);
  xrm.saveResource(propertyResource);
  routineItem.getProperty().setLabel("String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  IFile file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  Property oldProperty=xrm.loadProperty(file);
  String content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setLabel("String_Node_Str");
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  xrm.propagateFileName(routineItem.getProperty(),oldProperty);
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  routineItem.getProperty().setVersion("String_Node_Str");
  routineItem.getProperty().setLabel("String_Node_Str");
  routineItem.getContent().setInnerContent("String_Node_Str".getBytes());
  xrm.propagateFileName(routineItem.getProperty(),routineItem.getProperty());
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  xrm.propagateFileName(routineItem.getProperty(),xrm.loadProperty(file));
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  checkFileNotExists(project,ERepositoryObjectType.ROUTINES,"String_Node_Str","String_Node_Str");
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  List<Resource> resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  file=project.getFile(new Path(ERepositoryObjectType.getFolderName(ERepositoryObjectType.ROUTINES) + "String_Node_Str"));
  oldProperty=xrm.loadProperty(file);
  content=new String(((RoutineItem)oldProperty.getItem()).getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  resources=xrm.getAffectedResources(oldProperty);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
  content=new String(routineItem.getContent().getInnerContent());
  assertTrue(content.equals("String_Node_Str"));
  Property property=xrm.forceReloadProperty(routineItem.getProperty());
  resources=xrm.getAffectedResources(property);
  for (  Resource resource : resources) {
    xrm.deleteResource(resource);
  }
}