Program: 138388
Project: 138388
Buggy source:
private String copyFile(File targetFolder,File propFile,Property property,IPath path,String connNameAfter,Map<File,File> folderMap) throws IOException {
  String connName=null;
  File destItemFile=new Path(targetFolder.getAbsolutePath()).append(path).append(connNameAfter).addFileExtension(FactoriesUtil.ITEM_EXTENSION).toFile();
  File destPropFile=new Path(targetFolder.getAbsolutePath()).append(path).append(connNameAfter).addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
  File srcItemFile=new Path(propFile.getAbsolutePath()).removeFileExtension().addFileExtension(FactoriesUtil.ITEM_EXTENSION).toFile();
  File srcPropFile=propFile;
  Item item=property.getItem();
  if (destItemFile.exists()) {
    int num=0;
    if (item instanceof ConnectionItem) {
      Resource itemResource=getResource(srcItemFile.getAbsolutePath());
      Connection conn=null;
      for (      EObject object : itemResource.getContents()) {
        if (object instanceof Connection) {
          conn=(Connection)object;
          connName=conn.getName();
        }
      }
      while (destItemFile.exists() || destPropFile.exists()) {
        String version=property.getVersion();
        if (version == null) {
          version="String_Node_Str";
        }
        connName=connName + String.valueOf(++num);
        conn.setName(connName);
        connNameAfter=connName + "String_Node_Str" + version;
        destItemFile=new Path(destItemFile.getPath()).removeLastSegments(1).append(connNameAfter).addFileExtension(FactoriesUtil.ITEM_EXTENSION).toFile();
        destPropFile=new Path(destPropFile.getPath()).removeLastSegments(1).append(connNameAfter).addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
      }
    }
  }
  FileUtils.copyFile(srcItemFile,destItemFile);
  FileUtils.copyFile(srcPropFile,destPropFile);
  if (item instanceof ConnectionItem) {
    ConnectionItem connectionItem=(ConnectionItem)item;
    Resource itemResource=getResource(destItemFile.getAbsolutePath());
    Connection conn=null;
    for (    EObject object : itemResource.getContents()) {
      if (object instanceof Connection) {
        conn=(Connection)object;
        if (connName != null) {
          conn.setName(connName);
          conn.setLabel(connName);
        }
        String relationPropPath=ReponsitoryContextBridge.getRootProject().getFullPath().append(new Path(destPropFile.getPath()).makeRelativeTo(this.getWorkspacePath())).toOSString();
        MetadataHelper.setPropertyPath(relationPropPath,conn);
        connectionItem.setConnection(conn);
      }
    }
    EMFUtil.saveResource(itemResource);
    Resource propResource=getResource(destPropFile.getAbsolutePath());
    Property newProperty=(Property)EcoreUtil.getObjectByType(propResource.getContents(),PropertiesPackage.eINSTANCE.getProperty());
    newProperty.setAuthor(property.getAuthor());
    newProperty.setLabel(connectionItem.getConnection().getName());
    newProperty.setItem(item);
    item.setProperty(newProperty);
    propResource.getContents().clear();
    propResource.getContents().add(newProperty);
    propResource.getContents().add(item);
    propResource.getContents().add(item.getState());
    EMFUtil.saveResource(propResource);
  }
  return connNameAfter;
}

Fixed version (ground truth):
private String copyFile(File targetFolder,File propFile,Property property,IPath path,String connNameAfter,String connName,Map<File,File> folderMap) throws IOException {
  File destItemFile=new Path(targetFolder.getAbsolutePath()).append(path).append(connNameAfter).addFileExtension(FactoriesUtil.ITEM_EXTENSION).toFile();
  File destPropFile=new Path(targetFolder.getAbsolutePath()).append(path).append(connNameAfter).addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION).toFile();
  File srcItemFile=new Path(propFile.getAbsolutePath()).removeFileExtension().addFileExtension(FactoriesUtil.ITEM_EXTENSION).toFile();
  File srcPropFile=propFile;
  Item item=property.getItem();
  FileUtils.copyFile(srcItemFile,destItemFile);
  FileUtils.copyFile(srcPropFile,destPropFile);
  if (item instanceof ConnectionItem) {
    ConnectionItem connectionItem=(ConnectionItem)item;
    Resource itemResource=getResource(destItemFile.getAbsolutePath());
    Connection conn=null;
    for (    EObject object : itemResource.getContents()) {
      if (object instanceof Connection) {
        conn=(Connection)object;
        if (connName != null) {
          conn.setName(connName);
          conn.setLabel(connName);
        }
        String relationPropPath=ReponsitoryContextBridge.getRootProject().getFullPath().append(new Path(destPropFile.getPath()).makeRelativeTo(this.getWorkspacePath())).toOSString();
        MetadataHelper.setPropertyPath(relationPropPath,conn);
        connectionItem.setConnection(conn);
      }
    }
    EMFUtil.saveResource(itemResource);
    Resource propResource=getResource(destPropFile.getAbsolutePath());
    Property newProperty=(Property)EcoreUtil.getObjectByType(propResource.getContents(),PropertiesPackage.eINSTANCE.getProperty());
    newProperty.setAuthor(property.getAuthor());
    newProperty.setLabel(connectionItem.getConnection().getName());
    newProperty.setItem(item);
    item.setProperty(newProperty);
    propResource.getContents().clear();
    propResource.getContents().add(newProperty);
    propResource.getContents().add(item);
    propResource.getContents().add(item.getState());
    EMFUtil.saveResource(propResource);
  }
  return connNameAfter;
}