Program: 138109
Project: 138109
Buggy source:
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;
}

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;
    Connection conn=getConnectionFromFile(destItemFile);
    if (conn != null) {
      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(conn.eResource());
    Resource propResource=getResource(destPropFile);
    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;
}