Program: 129383
Project: 129383
Buggy source:
public void moveFolder(ERepositoryObjectType type,IPath sourcePath,IPath targetPath) throws PersistenceException {
  if (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) + IPath.SEPARATOR + targetPath.toString()+ IPath.SEPARATOR+ sourcePath.lastSegment();
  }
  if (completeNewPath.equals(completeOldPath)) {
    return;
  }
  IFolder folder=ResourceUtils.getFolder(fsProject,completeOldPath,false);
  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 (int i=0; i < childrens.length; i++) {
    if (childrens[i] instanceof FolderItem) {
      FolderItem children=(FolderItem)childrens[i];
      moveFolder(type,sourcePath.append(children.getProperty().getLabel()),targetPath.append(emfFolder.getProperty().getLabel()));
    }
 else {
      emfFolder.getChildren().remove(childrens[i]);
      newFolder.getChildren().add(childrens[i]);
      AbstractResourceChangesService resChangeService=TDQServiceRegister.getInstance().getResourceChangeService(AbstractResourceChangesService.class);
      if (resChangeService != null) {
        resChangeService.postMove(childrens[i],targetPath.toString() + IPath.SEPARATOR + sourcePath.lastSegment());
      }
      childrens[i].setParent(newFolder);
      List<Resource> affectedResources=xmiResourceManager.getAffectedResources(childrens[i].getProperty());
      for (      Resource resource : affectedResources) {
        IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
        Map<EObject,Collection<Setting>> find=EcoreUtil.ExternalCrossReferencer.find(resource);
        List<Resource> needSaves=new ArrayList<Resource>();
        for (        EObject object : find.keySet()) {
          Resource re=object.eResource();
          if (re == null) {
            continue;
          }
          EcoreUtil.resolveAll(re);
          needSaves.add(re);
        }
        xmiResourceManager.moveResource(resource,path);
        if (resChangeService != null) {
          for (          Resource toSave : needSaves) {
            resChangeService.saveResourceByEMFShared(toSave);
          }
        }
      }
      affectedResources=xmiResourceManager.getAffectedResources(childrens[i].getProperty());
      for (      Resource resource : affectedResources) {
        xmiResourceManager.saveResource(resource);
      }
    }
  }
  List<IRepositoryViewObject> serializableFromFolder=getSerializableFromFolder(project,folder,null,type,true,true,true,false);
  for (  IRepositoryViewObject object : serializableFromFolder) {
    List<Resource> affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    for (    Resource resource : affectedResources) {
      IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
      xmiResourceManager.moveResource(resource,path);
    }
  }
  deleteFolder(getRepositoryContext().getProject(),type,sourcePath);
  xmiResourceManager.saveResource(getRepositoryContext().getProject().getEmfProject().eResource());
}

Fixed version (ground truth):
public void moveFolder(ERepositoryObjectType type,IPath sourcePath,IPath targetPath) throws PersistenceException {
  if (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) + IPath.SEPARATOR + targetPath.toString()+ IPath.SEPARATOR+ sourcePath.lastSegment();
  }
  if (completeNewPath.equals(completeOldPath)) {
    return;
  }
  IFolder folder=ResourceUtils.getFolder(fsProject,completeOldPath,false);
  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 (int i=0; i < childrens.length; i++) {
    if (childrens[i] instanceof FolderItem) {
      FolderItem children=(FolderItem)childrens[i];
      moveFolder(type,sourcePath.append(children.getProperty().getLabel()),targetPath.append(emfFolder.getProperty().getLabel()));
    }
 else {
      emfFolder.getChildren().remove(childrens[i]);
      newFolder.getChildren().add(childrens[i]);
      childrens[i].setParent(newFolder);
      List<Resource> affectedResources=xmiResourceManager.getAffectedResources(childrens[i].getProperty());
      for (      Resource resource : affectedResources) {
        IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
        Map<EObject,Collection<Setting>> find=EcoreUtil.ExternalCrossReferencer.find(resource);
        List<Resource> needSaves=new ArrayList<Resource>();
        for (        EObject object : find.keySet()) {
          Resource re=object.eResource();
          if (re == null) {
            continue;
          }
          EcoreUtil.resolveAll(re);
          needSaves.add(re);
        }
        xmiResourceManager.moveResource(resource,path);
        AbstractResourceChangesService resChangeService=TDQServiceRegister.getInstance().getResourceChangeService(AbstractResourceChangesService.class);
        if (resChangeService != null) {
          for (          Resource toSave : needSaves) {
            resChangeService.saveResourceByEMFShared(toSave);
          }
        }
      }
      affectedResources=xmiResourceManager.getAffectedResources(childrens[i].getProperty());
      for (      Resource resource : affectedResources) {
        xmiResourceManager.saveResource(resource);
      }
    }
  }
  List<IRepositoryViewObject> serializableFromFolder=getSerializableFromFolder(project,folder,null,type,true,true,true,false);
  for (  IRepositoryViewObject object : serializableFromFolder) {
    List<Resource> affectedResources=xmiResourceManager.getAffectedResources(object.getProperty());
    for (    Resource resource : affectedResources) {
      IPath path=getPhysicalProject(project).getFullPath().append(completeNewPath).append(resource.getURI().lastSegment());
      xmiResourceManager.moveResource(resource,path);
    }
  }
  deleteFolder(getRepositoryContext().getProject(),type,sourcePath);
  xmiResourceManager.saveResource(getRepositoryContext().getProject().getEmfProject().eResource());
}