Program: 127429
Project: 127429
Buggy source:
@Override public void moveFolder(final ERepositoryObjectType type,final IPath sourcePath,final IPath targetPath) throws PersistenceException {
  if (type == null || RepositoryConstants.isSystemFolder(sourcePath.toString()) || RepositoryConstants.isSystemFolder(targetPath.toString())) {
    return;
  }
  Project project=getRepositoryContext().getProject();
  IProject fsProject=ResourceModelUtils.getProject(project);
  String completeOldPath=ERepositoryObjectType.getFolderName(type) + IPath.SEPARATOR + sourcePath.toString();
  String completeNewPath;
  if (targetPath.equals("String_Node_Str")) {
    completeNewPath=ERepositoryObjectType.getFolderName(type) + IPath.SEPARATOR + sourcePath.lastSegment();
  }
 else {
    completeNewPath=ERepositoryObjectType.getFolderName(type) + ("String_Node_Str".equals(targetPath.toString()) ? "String_Node_Str" : IPath.SEPARATOR + targetPath.toString()) + IPath.SEPARATOR+ sourcePath.lastSegment();
  }
  if (completeNewPath.equals(completeOldPath)) {
    return;
  }
  IFolder folder=ResourceUtils.getFolder(fsProject,completeOldPath,true);
  FolderHelper folderHelper=getFolderHelper(getRepositoryContext().getProject().getEmfProject());
  FolderItem emfFolder=folderHelper.getFolder(completeOldPath);
  if (emfFolder == null && (type == ERepositoryObjectType.JOB_DOC || type == ERepositoryObjectType.JOBLET_DOC)) {
    IPath path=new Path(sourcePath.toString());
    ProxyRepositoryFactory.getInstance().createParentFoldersRecursively(project,type,path);
    emfFolder=folderHelper.getFolder(completeOldPath);
  }
  createFolder(getRepositoryContext().getProject(),type,targetPath,emfFolder.getProperty().getLabel());
  FolderItem newFolder=folderHelper.getFolder(completeNewPath);
  Item[] childrens=(Item[])emfFolder.getChildren().toArray();
  for (  Item children2 : childrens) {
    if (children2 instanceof FolderItem) {
      FolderItem children=(FolderItem)children2;
      moveFolder(type,sourcePath.append(children.getProperty().getLabel()),targetPath.append(emfFolder.getProperty().getLabel()));
    }
 else {
      moveOldContentToNewFolder(project,completeNewPath,emfFolder,newFolder,children2);
    }
  }
  List<IRepositoryViewObject> serializableFromFolder=getSerializableFromFolder(project,folder,null,type,true,true,true,false);
  for (  IRepositoryViewObject object : serializableFromFolder) {
    dealTdqResourceMove(project,completeNewPath,object);
    List<Resource> affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    Map<Resource,IPath> resourceAndPathMap=new HashMap<Resource,IPath>();
    for (    Resource resource : affectedResources) {
      IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
      resourceAndPathMap.put(resource,path);
      List<Resource> needSaves=findCrossReference(resource);
      moveResource(resource,path);
      saveCrossReference(needSaves);
    }
    IPath parentPath=getPhysicalProject(project).getFullPath().append(completeNewPath);
    svnMoveResource(affectedResources,parentPath,resourceAndPathMap);
    affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    for (    Resource resource : affectedResources) {
      xmiResourceManager.saveResource(resource);
    }
  }
  deleteFolder(getRepositoryContext().getProject(),type,sourcePath);
  xmiResourceManager.saveResource(getRepositoryContext().getProject().getEmfProject().eResource());
}

Fixed version (ground truth):
@Override public void moveFolder(final ERepositoryObjectType type,final IPath sourcePath,final IPath targetPath) throws PersistenceException {
  if (type == null || RepositoryConstants.isSystemFolder(sourcePath.toString()) || RepositoryConstants.isSystemFolder(targetPath.toString())) {
    return;
  }
  Project project=getRepositoryContext().getProject();
  IProject fsProject=ResourceModelUtils.getProject(project);
  String completeOldPath=ERepositoryObjectType.getFolderName(type) + IPath.SEPARATOR + sourcePath.toString();
  String completeNewPath;
  if (targetPath.equals("String_Node_Str")) {
    completeNewPath=ERepositoryObjectType.getFolderName(type) + IPath.SEPARATOR + sourcePath.lastSegment();
  }
 else {
    completeNewPath=ERepositoryObjectType.getFolderName(type) + ("String_Node_Str".equals(targetPath.toString()) ? "String_Node_Str" : IPath.SEPARATOR + targetPath.toString()) + IPath.SEPARATOR+ sourcePath.lastSegment();
  }
  if (completeNewPath.equals(completeOldPath)) {
    return;
  }
  IFolder folder=ResourceUtils.getFolder(fsProject,completeOldPath,true);
  FolderHelper folderHelper=getFolderHelper(getRepositoryContext().getProject().getEmfProject());
  FolderItem emfFolder=folderHelper.getFolder(completeOldPath);
  if (emfFolder == null && (type == ERepositoryObjectType.JOB_DOC || type == ERepositoryObjectType.JOBLET_DOC)) {
    IPath path=new Path(sourcePath.toString());
    ProxyRepositoryFactory.getInstance().createParentFoldersRecursively(project,type,path);
    emfFolder=folderHelper.getFolder(completeOldPath);
  }
  createFolder(getRepositoryContext().getProject(),type,targetPath,emfFolder.getProperty().getLabel());
  FolderItem newFolder=folderHelper.getFolder(completeNewPath);
  boolean isDel=emfFolder.getState().isDeleted();
  if (isDel) {
    newFolder.getState().setDeleted(isDel);
  }
  Item[] childrens=(Item[])emfFolder.getChildren().toArray();
  for (  Item children2 : childrens) {
    if (children2 instanceof FolderItem) {
      FolderItem children=(FolderItem)children2;
      moveFolder(type,sourcePath.append(children.getProperty().getLabel()),targetPath.append(emfFolder.getProperty().getLabel()));
    }
 else {
      moveOldContentToNewFolder(project,completeNewPath,emfFolder,newFolder,children2);
    }
  }
  List<IRepositoryViewObject> serializableFromFolder=getSerializableFromFolder(project,folder,null,type,true,true,true,false);
  for (  IRepositoryViewObject object : serializableFromFolder) {
    dealTdqResourceMove(project,completeNewPath,object);
    List<Resource> affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    Map<Resource,IPath> resourceAndPathMap=new HashMap<Resource,IPath>();
    for (    Resource resource : affectedResources) {
      IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
      resourceAndPathMap.put(resource,path);
      List<Resource> needSaves=findCrossReference(resource);
      moveResource(resource,path);
      saveCrossReference(needSaves);
    }
    IPath parentPath=getPhysicalProject(project).getFullPath().append(completeNewPath);
    svnMoveResource(affectedResources,parentPath,resourceAndPathMap);
    affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    for (    Resource resource : affectedResources) {
      xmiResourceManager.saveResource(resource);
    }
  }
  deleteFolder(getRepositoryContext().getProject(),type,sourcePath);
  xmiResourceManager.saveResource(getRepositoryContext().getProject().getEmfProject().eResource());
}