Program: 138569
Project: 138569
Buggy source:
/** 
 * update ModelElement files (Analysis, Report, IndicatorDefinition, Pattern, Rule).
 * @param parentFile
 * @param fileExtension
 * @param baseFolder
 * @param baseFile
 * @param createSubFolder
 * @param replaceStringMap
 * @return
 */
private boolean updateModelElements(File parentFile,String fileExtension,IFolder baseFolder,File baseFile,boolean createSubFolder,Map<String,String> replaceStringMap){
  try {
    if (!parentFile.isFile()) {
      boolean updateSubFolders=true;
      if (createSubFolder) {
        updateSubFolders=createSubFolder(parentFile,baseFolder);
      }
      if (updateSubFolders) {
        File[] listFiles=parentFile.listFiles();
        for (        File file : listFiles) {
          updateModelElements(file,fileExtension,baseFolder,baseFile,createSubFolder,replaceStringMap);
        }
      }
    }
 else {
      if (parentFile.getName().endsWith(fileExtension)) {
        ModelElement modelElement=getModelElement(parentFile);
        if (modelElement != null) {
          IFolder fullPathFolder=getFullPathFolder(baseFolder,baseFile,parentFile);
          ElementWriterFactory.getInstance().createPatternWriter().create(modelElement,fullPathFolder);
          IPath replatePrefixPath=fullPathFolder.getFullPath().removeFirstSegments(2);
          String oldFileNameFull=replatePrefixPath.append(parentFile.getName()).toString();
          String newFileNameFull=replatePrefixPath.append(getDefaultNewFileName(modelElement.getName(),fileExtension)).toString();
          replaceStringMap.put(oldFileNameFull,newFileNameFull);
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * update ModelElement files (Analysis, Report, IndicatorDefinition, Pattern, Rule).
 * @param parentFile
 * @param fileExtension
 * @param baseFolder
 * @param baseFile
 * @param createSubFolder
 * @param replaceStringMap
 * @return
 */
private boolean updateModelElements(File parentFile,String fileExtension,IFolder baseFolder,File baseFile,boolean createSubFolder,Map<String,String> replaceStringMap){
  boolean isImport=true;
  try {
    if (!parentFile.isFile()) {
      boolean updateSubFolders=true;
      if (createSubFolder) {
        updateSubFolders=createSubFolder(parentFile,baseFolder);
      }
      if (updateSubFolders) {
        File[] listFiles=parentFile.listFiles();
        for (        File file : listFiles) {
          updateModelElements(file,fileExtension,baseFolder,baseFile,createSubFolder,replaceStringMap);
        }
      }
    }
 else {
      if (parentFile.getName().endsWith(fileExtension)) {
        ModelElement modelElement=getModelElement(parentFile);
        if (modelElement != null) {
          IFolder fullPathFolder=getFullPathFolder(baseFolder,baseFile,parentFile);
          ElementWriterFactory.getInstance().createPatternWriter().create(modelElement,fullPathFolder,isImport);
          IPath replatePrefixPath=fullPathFolder.getFullPath().removeFirstSegments(2);
          String oldFileNameFull=replatePrefixPath.append(parentFile.getName()).toString();
          String newFileNameFull=replatePrefixPath.append(getDefaultNewFileName(modelElement.getName(),fileExtension)).toString();
          replaceStringMap.put(oldFileNameFull,newFileNameFull);
        }
      }
    }
  }
 catch (  Exception e) {
    log.error(e,e);
    return false;
  }
  return true;
}