Program: 139497
Project: 139497
Buggy source:
private void movePatternsIntoPatternsRegex(IFolder oldSubFolder,IFolder newSubfolder,final String folderProperty) throws CoreException {
  TdqPropertieManager.getInstance().addFolderProperties(newSubfolder,DQStructureManager.FOLDER_CLASSIFY_KEY,folderProperty);
  for (  IResource oldResource : oldSubFolder.members()) {
    if (newSubfolder.getName().equals(oldResource.getName())) {
      continue;
    }
    if (oldResource instanceof IFolder) {
      IFolder oldFolder=(IFolder)oldResource;
      IFolder newFolder=DQStructureManager.getInstance().createNewFolder(newSubfolder,oldFolder.getName());
      TdqPropertieManager.getInstance().addFolderProperties(newFolder,DQStructureManager.FOLDER_CLASSIFY_KEY,folderProperty);
      movePatternsIntoPatternsRegex(oldFolder,newFolder,folderProperty);
      oldFolder.delete(true,null);
    }
    if (oldResource instanceof IFile) {
      IFile file=(IFile)oldResource;
      final ModelElement pattern=getModelElement(file,folderProperty);
      final EList<Dependency> supplierDependency=pattern.getSupplierDependency();
      if (supplierDependency.isEmpty()) {
        oldResource.copy(newSubfolder.getFolder(oldResource.getName()).getFullPath(),true,null);
      }
 else {
        for (        Dependency dependency : supplierDependency) {
          URI newUri=URI.createPlatformResourceURI(newSubfolder.getFullPath().toOSString(),true);
          EMFUtil.changeUri(pattern.eResource(),newUri);
          final EList<ModelElement> clientAnalyses=dependency.getClient();
          for (          ModelElement modelElement : clientAnalyses) {
            Analysis analysis=DataqualitySwitchHelper.ANALYSIS_SWITCH.doSwitch(modelElement);
            if (analysis != null) {
              AnaResourceFileHelper.getInstance().save(analysis);
            }
          }
        }
      }
      oldResource.delete(true,null);
    }
  }
}

Fixed version (ground truth):
private void movePatternsIntoPatternsRegex(IFolder oldSubFolder,IFolder newSubfolder,final String folderProperty) throws CoreException {
  if (!oldSubFolder.exists())   return;
  TdqPropertieManager.getInstance().addFolderProperties(newSubfolder,DQStructureManager.FOLDER_CLASSIFY_KEY,folderProperty);
  for (  IResource oldResource : oldSubFolder.members()) {
    if (newSubfolder.getName().equals(oldResource.getName())) {
      continue;
    }
    if (oldResource instanceof IFolder) {
      IFolder oldFolder=(IFolder)oldResource;
      IFolder newFolder=DQStructureManager.getInstance().createNewFolder(newSubfolder,oldFolder.getName());
      TdqPropertieManager.getInstance().addFolderProperties(newFolder,DQStructureManager.FOLDER_CLASSIFY_KEY,folderProperty);
      movePatternsIntoPatternsRegex(oldFolder,newFolder,folderProperty);
      oldFolder.delete(true,null);
    }
    if (oldResource instanceof IFile) {
      IFile file=(IFile)oldResource;
      final ModelElement pattern=getModelElement(file,folderProperty);
      final EList<Dependency> supplierDependency=pattern.getSupplierDependency();
      if (supplierDependency.isEmpty()) {
        oldResource.copy(newSubfolder.getFolder(oldResource.getName()).getFullPath(),true,null);
      }
 else {
        for (        Dependency dependency : supplierDependency) {
          URI newUri=URI.createPlatformResourceURI(newSubfolder.getFullPath().toOSString(),true);
          EMFUtil.changeUri(pattern.eResource(),newUri);
          final EList<ModelElement> clientAnalyses=dependency.getClient();
          for (          ModelElement modelElement : clientAnalyses) {
            Analysis analysis=DataqualitySwitchHelper.ANALYSIS_SWITCH.doSwitch(modelElement);
            if (analysis != null) {
              AnaResourceFileHelper.getInstance().save(analysis);
            }
          }
        }
      }
      oldResource.delete(true,null);
    }
  }
}