nus-yam/ex-repair huggingface dataset:
Program: 138782
Project: 138782
Buggy source:
/** 
 * DOC bZhou Comment method "createProperty". Create and save a property from model element resource.
 * @param modelElement
 * @return
 */
public Property createProperty(ModelElement modelElement){
  Resource eResource=modelElement.eResource();
  if (eResource == null) {
    log.error("String_Node_Str");
    return null;
  }
  Property property=initProperty(modelElement);
  URI propURI=eResource.getURI().trimFileExtension().appendFileExtension(FactoriesUtil.PROPERTIES_EXTENSION);
  saveProperty(property,propURI);
  return property;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "createProperty". Create and save a property from model element resource.
 * @param modelElement
 * @return
 */
public Property createProperty(ModelElement modelElement){
  Resource eResource=modelElement.eResource();
  if (eResource == null) {
    log.error("String_Node_Str");
    return null;
  }
  Property property=initProperty(modelElement);
  User user=ReponsitoryContextBridge.getUser();
  if (user != null) {
    property.setAuthor(user);
  }
  URI propURI=eResource.getURI().trimFileExtension().appendFileExtension(FactoriesUtil.PROPERTIES_EXTENSION);
  saveProperty(property,propURI);
  return property;
}
Program: 138783
Project: 138783
Buggy source:
protected Collection<Analysis> searchAllAnalysis(IFolder folder){
  Collection<Analysis> analyses=new ArrayList<Analysis>();
  try {
    for (    IResource resource : folder.members()) {
      if (resource.getType() == IResource.FOLDER) {
        analyses.addAll(searchAllAnalysis(folder.getFolder(resource.getName())));
        continue;
      }
      IFile file=(IFile)resource;
      if (file.getFileExtension().equals(FactoriesUtil.ANA)) {
        analyses.add(AnaResourceFileHelper.getInstance().findAnalysis(file));
      }
    }
  }
 catch (  CoreException e) {
    log.error(e);
  }
  return analyses;
}

Fixed version (ground truth):
protected Collection<Analysis> searchAllAnalysis(IFolder folder){
  Collection<Analysis> analyses=new ArrayList<Analysis>();
  ResourceSet resoruceSet=new ResourceSetImpl();
  try {
    for (    IResource resource : folder.members()) {
      if (resource.getType() == IResource.FOLDER) {
        analyses.addAll(searchAllAnalysis(folder.getFolder(resource.getName())));
        continue;
      }
      IFile file=(IFile)resource;
      if (file.getFileExtension().equals(FactoriesUtil.ANA)) {
        URI uri=URI.createPlatformResourceURI(file.getFullPath().toString(),false);
        Resource eResource=resoruceSet.getResource(uri,true);
        analyses.add((Analysis)eResource.getContents().get(0));
      }
    }
  }
 catch (  CoreException e) {
    log.error(e);
  }
  return analyses;
}
Program: 138785
Project: 138785
Buggy source:
@Override protected boolean doExecute() throws Exception {
  IndicatorDefinition definition0=IndicatorDefinitionFileHelper.getSystemIndicatorByName(UNIQUE_COUNT);
  IndicatorDefinitionFileHelper.addSqlExpression(definition0,SYBASE,"String_Node_Str");
  IndicatorDefinition definition1=IndicatorDefinitionFileHelper.getSystemIndicatorByName(DUPLICATE_COUNT);
  IndicatorDefinitionFileHelper.addSqlExpression(definition1,SYBASE,"String_Node_Str");
  IndicatorDefinition definition2=IndicatorDefinitionFileHelper.getSystemIndicatorByName(BLANK_COUNT);
  IndicatorDefinitionFileHelper.addSqlExpression(definition2,SYBASE,"String_Node_Str");
  return IndicatorDefinitionFileHelper.save(definition0) & IndicatorDefinitionFileHelper.save(definition1) & IndicatorDefinitionFileHelper.save(definition2);
}

Fixed version (ground truth):
@Override protected boolean doExecute() throws Exception {
  IndicatorDefinition definition0=IndicatorDefinitionFileHelper.getSystemIndicatorByName(UNIQUE_COUNT);
  IndicatorDefinition definition1=IndicatorDefinitionFileHelper.getSystemIndicatorByName(DUPLICATE_COUNT);
  IndicatorDefinition definition2=IndicatorDefinitionFileHelper.getSystemIndicatorByName(BLANK_COUNT);
  if (definition0 != null && definition1 != null && definition2 != null) {
    IndicatorDefinitionFileHelper.addSqlExpression(definition0,SYBASE,"String_Node_Str");
    IndicatorDefinitionFileHelper.addSqlExpression(definition1,SYBASE,"String_Node_Str");
    IndicatorDefinitionFileHelper.addSqlExpression(definition2,SYBASE,"String_Node_Str");
    return IndicatorDefinitionFileHelper.save(definition0) & IndicatorDefinitionFileHelper.save(definition1) & IndicatorDefinitionFileHelper.save(definition2);
  }
  return false;
}
Program: 138786
Project: 138786
Buggy source:
/** 
 * DOC bZhou Comment method "update".
 * @param desFile
 * @throws IOException
 */
private void update(File desFile) throws IOException {
  String curProjectLabel=ResourceManager.getRootProjectName();
  if (!StringUtils.equals(projectName,curProjectLabel)) {
    String content=FileUtils.readFileToString(desFile,"String_Node_Str");
    content=StringUtils.replace(content,"String_Node_Str" + projectName + "String_Node_Str","String_Node_Str" + curProjectLabel + "String_Node_Str");
    FileUtils.writeStringToFile(desFile,content,"String_Node_Str");
  }
  if (desFile.getName().endsWith(FactoriesUtil.PROPERTIES_EXTENSION)) {
    Property property=PropertyHelper.getProperty(desFile);
    User user=ReponsitoryContextBridge.getUser();
    if (user != null) {
      property.setAuthor(user);
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "update".
 * @param desFile
 * @throws IOException
 */
private void update(File desFile) throws IOException {
  String curProjectLabel=ResourceManager.getRootProjectName();
  if (!StringUtils.equals(projectName,curProjectLabel)) {
    String content=FileUtils.readFileToString(desFile,"String_Node_Str");
    content=StringUtils.replace(content,"String_Node_Str" + projectName + "String_Node_Str","String_Node_Str" + curProjectLabel + "String_Node_Str");
    FileUtils.writeStringToFile(desFile,content,"String_Node_Str");
  }
  if (desFile.getName().endsWith(FactoriesUtil.PROPERTIES_EXTENSION)) {
    Property property=PropertyHelper.getProperty(desFile);
    User user=ReponsitoryContextBridge.getUser();
    if (user != null) {
      property.setAuthor(user);
    }
    EMFSharedResources.getInstance().saveResource(property.eResource());
  }
}
Program: 138787
Project: 138787
Buggy source:
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists() || !definitionFile.exists()) {
      return null;
    }
    IPath projPath=path.append("String_Node_Str");
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
    }
  }
  return new ItemRecord(path.toFile());
}

Fixed version (ground truth):
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists()) {
      return null;
    }
    IPath projPath=path.append("String_Node_Str");
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
    }
  }
  return new ItemRecord(path.toFile());
}
Program: 138788
Project: 138788
Buggy source:
/** 
 * DOC bZhou Comment method "checkExisted".
 * @param record
 */
private void checkExisted(ItemRecord record){
  Property property=record.getProperty();
  if (property != null) {
    IPath itemPath=PropertyHelper.getItemPath(property);
    IFile itemFile=ResourcesPlugin.getWorkspace().getRoot().getFile(itemPath);
    try {
      itemFile.getParent().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
    }
    String aString=record.getName();
    if (itemFile.exists()) {
      record.addError("String_Node_Str" + aString + "String_Node_Str"+ itemFile.getFullPath().toString());
    }
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "checkExisted".
 * @param record
 */
private void checkExisted(ItemRecord record){
  Property property=record.getProperty();
  if (property != null) {
    IPath itemPath=PropertyHelper.getItemPath(property);
    IFile itemFile=ResourcesPlugin.getWorkspace().getRoot().getFile(itemPath);
    try {
      itemFile.getParent().refreshLocal(IResource.DEPTH_INFINITE,null);
    }
 catch (    CoreException e) {
    }
    String aString=record.getName();
    if (itemFile.exists()) {
      ModelElementFileFactory.getResourceFileMap(itemFile).clear();
      URI itemURI=URI.createPlatformResourceURI(itemFile.getFullPath().toString(),false);
      EMFSharedResources.getInstance().unloadResource(itemURI.toString());
      URI propURI=itemURI.trimFileExtension().appendFileExtension(FactoriesUtil.PROPERTIES_EXTENSION);
      EMFSharedResources.getInstance().unloadResource(propURI.toString());
      record.addError("String_Node_Str" + aString + "String_Node_Str"+ itemFile.getFullPath().toString());
    }
  }
}
Program: 138789
Project: 138789
Buggy source:
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    Iterator<IMigrationTask> it=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version).iterator();
    while (it.hasNext()) {
      IMigrationTask task=it.next();
      if (isModelTask(task)) {
        ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
        modelTasks.add(task);
      }
 else {
        commonTasks.add(task);
      }
    }
  }
  if (!modelTasks.isEmpty()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
  }
}

Fixed version (ground truth):
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    List<IMigrationTask> taskList=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version);
    if (!taskList.isEmpty()) {
      for (      IMigrationTask task : taskList) {
        if (isModelTask(task)) {
          ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
          modelTasks.add(task);
        }
 else {
          commTasks.add(task);
        }
      }
    }
  }
  File file=basePath.append(EResourceConstant.LIBRARIES.getPath()).append("String_Node_Str").toFile();
  if (!modelTasks.isEmpty() && !file.exists()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
    try {
      file.createNewFile();
    }
 catch (    IOException e) {
      ExceptionHandler.process(e);
    }
  }
}
Program: 138790
Project: 138790
Buggy source:
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
 else {
    if (!defFile.exists()) {
      DefinitionHandler.getInstance();
    }
  }
  ResourceService.refreshStructure();
  if (commonTasks != null) {
    MigrationTaskManager.doMigrationTask(commonTasks,monitor);
  }
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(true);
}

Fixed version (ground truth):
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
  ResourceService.refreshStructure();
  if (!commTasks.isEmpty() && monitor != null) {
    MigrationTaskManager.doMigrationTask(commTasks,monitor);
  }
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(true);
}
Program: 138791
Project: 138791
Buggy source:
/** 
 * DOC bZhou Comment method "initWorkspace".
 */
private void initWorkspace(){
  ResourceService.initResourcePersistence();
  SQLExplorerPlugin.getDefault().initAllDrivers();
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(Boolean.TRUE);
  Collection<Connection> providers=ProxyRepositoryViewObject.getAllDatabaseConnections();
  for (  DataProvider provider : providers) {
    CWMPlugin.getDefault().addConnetionAliasToSQLPlugin(provider);
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "initWorkspace".
 */
private void initWorkspace(){
  ResourceService.initResourcePersistence();
  SQLExplorerPlugin.getDefault().initAllDrivers();
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(Boolean.TRUE);
  Collection<Connection> providers=ProxyRepositoryViewObject.getAllDatabaseConnections();
  for (  DataProvider provider : providers) {
    CWMPlugin.getDefault().addConnetionAliasToSQLPlugin(provider);
  }
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME);
  if (!defFile.exists()) {
    DefinitionHandler.getInstance();
  }
}
Program: 138792
Project: 138792
Buggy source:
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile model=(IFile)element;
    Property property=PropertyHelper.getProperty(model);
    if (null != property && property.getItem().getState().isDeleted()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean select(Viewer viewer,Object parentElement,Object element){
  if (element instanceof IFile) {
    IFile model=(IFile)element;
    Property property=PropertyHelper.getProperty(model);
    if (null != property && property.getItem().getState().isDeleted()) {
      return false;
    }
  }
  if (element instanceof RepositoryObject) {
    RepositoryObject obj=(RepositoryObject)element;
    Property property=obj.getProperty();
    if (null != property && property.getItem().getState().isDeleted()) {
      return false;
    }
  }
  return true;
}
Program: 138793
Project: 138793
Buggy source:
public void createControl(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  container.setLayout(layout);
  Label nameLabel=new Label(container,SWT.NONE);
  nameLabel.setText(nameLabTxt);
  createMetaDataTree(container);
  setControl(container);
  addFilters(new EMFObjFilter(),new DQFolderFliter(true),new TDQEEConnectionFolderFilter());
  addListeners();
}

Fixed version (ground truth):
public void createControl(Composite parent){
  Composite container=new Composite(parent,SWT.NONE);
  GridLayout layout=new GridLayout();
  container.setLayout(layout);
  Label nameLabel=new Label(container,SWT.NONE);
  nameLabel.setText(nameLabTxt);
  createMetaDataTree(container);
  setControl(container);
  addFilters(new EMFObjFilter(),new DQFolderFliter(true),new TDQEEConnectionFolderFilter(),new RecycleBinFilter());
  addListeners();
}
Program: 138794
Project: 138794
Buggy source:
/** 
 * DOC xqliu Comment method "updateAnalysisClientDependencyConnection". bug 14014
 * @param analysis
 */
public void updateAnalysisClientDependencyConnection(Analysis analysis){
  List<Dependency> realDependency=new ArrayList<Dependency>();
  EList<Dependency> clientDependency=analysis.getClientDependency();
  DataManager connection=analysis.getContext().getConnection();
  if (clientDependency != null) {
    for (    Dependency dependency : clientDependency) {
      EList<ModelElement> supplier=dependency.getSupplier();
      if (supplier != null && supplier.size() > 0) {
        ModelElement modelElement=supplier.get(0);
        if (modelElement != null) {
          if (modelElement instanceof Connection) {
            if (modelElement.equals(connection)) {
              realDependency.add(dependency);
            }
          }
 else {
            realDependency.add(dependency);
          }
        }
      }
    }
    clientDependency.clear();
    clientDependency.addAll(realDependency);
  }
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "updateAnalysisClientDependencyConnection". bug 14014
 * @param analysis
 */
public void updateAnalysisClientDependencyConnection(Analysis analysis){
  List<Dependency> realDependency=new ArrayList<Dependency>();
  EList<Dependency> clientDependency=analysis.getClientDependency();
  DataManager connection=analysis.getContext().getConnection();
  if (clientDependency != null) {
    for (    Dependency dependency : clientDependency) {
      if (dependency.eIsProxy()) {
        dependency=(Dependency)EObjectHelper.resolveObject(dependency);
      }
      EList<ModelElement> supplier=dependency.getSupplier();
      if (supplier != null && supplier.size() > 0) {
        ModelElement modelElement=supplier.get(0);
        if (modelElement != null) {
          if (modelElement instanceof Connection) {
            if (modelElement.equals(connection)) {
              realDependency.add(dependency);
            }
          }
 else {
            realDependency.add(dependency);
          }
        }
      }
    }
    clientDependency.clear();
    clientDependency.addAll(realDependency);
  }
}
Program: 138795
Project: 138795
Buggy source:
/** 
 * DOC mzhao Get all metadata connections.
 * @return
 */
public static List<Connection> getAllMetadataConnections(){
  List<Connection> metadataConns=new ArrayList<Connection>();
  metadataConns.addAll(getDBConnectionInstance().getAllElements());
  metadataConns.addAll(getMDMConnectionInstance().getAllElements());
  return metadataConns;
}

Fixed version (ground truth):
/** 
 * DOC yyi Get all metadata connections.
 * @return
 */
public static List<Connection> getAllMetadataConnections(boolean excludeRecycleBin){
  List<Connection> connections=new ArrayList<Connection>();
  if (excludeRecycleBin) {
    for (    Connection con : getAllMetadataConnections()) {
      if (null == con.eResource()) {
        con=(Connection)EObjectHelper.resolveObject(con);
      }
      if (null != con.eResource() && !PropertyHelper.getProperty(con).getItem().getState().isDeleted()) {
        connections.add(con);
      }
    }
  }
  return connections;
}
Program: 138796
Project: 138796
Buggy source:
protected void reloadDataproviderAndFillConnCombo(){
  Collection<Connection> connections=ProxyRepositoryViewObject.getAllMetadataConnections();
  int index=0;
  connCombo.removeAll();
  for (  Connection prov : connections) {
    connCombo.add(prov.getName(),index);
    connCombo.setData(prov.getName(),index);
    connCombo.setData(index + "String_Node_Str",prov);
    index++;
  }
  if (index > 0) {
    connCombo.select(0);
  }
}

Fixed version (ground truth):
protected void reloadDataproviderAndFillConnCombo(){
  Collection<Connection> connections=ProxyRepositoryViewObject.getAllMetadataConnections(true);
  int index=0;
  connCombo.removeAll();
  for (  Connection prov : connections) {
    connCombo.add(prov.getName(),index);
    connCombo.setData(prov.getName(),index);
    connCombo.setData(index + "String_Node_Str",prov);
    index++;
  }
  if (index > 0) {
    connCombo.select(0);
  }
}
Program: 138797
Project: 138797
Buggy source:
public Date getOrder(){
  return createDate(2010,07,06);
}

Fixed version (ground truth):
public Date getOrder(){
  return createDate(2010,06,20);
}
Program: 138798
Project: 138798
Buggy source:
private void tansferFile(File parentFolder) throws Exception {
  if (!parentFolder.exists()) {
    return;
  }
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(parentFolder,fileList,nonPropertyFileFilter);
  for (  File propFile : fileList) {
    URI uri=URI.createFileURI(propFile.getAbsolutePath());
    Resource resource=resourceSet.getResource(uri,true);
    Property property=(Property)EcoreUtil.getObjectByType(resource.getContents(),PropertiesPackage.eINSTANCE.getProperty());
    if (property != null) {
      Item item=property.getItem();
      if (item instanceof ConnectionItem) {
        Connection conn=((ConnectionItem)item).getConnection();
        property.setLabel(conn.getName());
      }
      IPath path=new Path(item.getState().getPath());
      if (ProxyRepositoryFactory.getInstance().getFolderItem(ProjectManager.getInstance().getCurrentProject(),ERepositoryObjectType.getItemType(item),path) == null) {
        ProxyRepositoryFactory.getInstance().createFolder(ERepositoryObjectType.getItemType(item),path.removeLastSegments(1),path.lastSegment());
      }
      ProxyRepositoryFactory.getInstance().create(item,path,true);
    }
  }
}

Fixed version (ground truth):
private void tansferFile(File parentFolder) throws Exception {
  if (!parentFolder.exists()) {
    return;
  }
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(parentFolder,fileList,nonPropertyFileFilter);
  for (  File propFile : fileList) {
    URI uri=URI.createFileURI(propFile.getAbsolutePath());
    Resource resource=resourceSet.getResource(uri,true);
    Property property=(Property)EcoreUtil.getObjectByType(resource.getContents(),PropertiesPackage.eINSTANCE.getProperty());
    if (property != null) {
      Item item=property.getItem();
      if (item instanceof ConnectionItem) {
        String fileName=propFile.getName();
        int lastIndex=fileName.lastIndexOf("String_Node_Str");
        if (lastIndex > 0) {
          fileName=fileName.substring(0,lastIndex);
        }
 else {
          fileName=new Path(fileName).removeFileExtension().lastSegment();
        }
        property.setLabel(fileName);
      }
      IPath path=new Path(item.getState().getPath());
      if (ProxyRepositoryFactory.getInstance().getFolderItem(ProjectManager.getInstance().getCurrentProject(),ERepositoryObjectType.getItemType(item),path) == null) {
        ProxyRepositoryFactory.getInstance().createFolder(ERepositoryObjectType.getItemType(item),path.removeLastSegments(1),path.lastSegment());
      }
      ProxyRepositoryFactory.getInstance().create(item,path,true);
    }
  }
}
Program: 138802
Project: 138802
Buggy source:
/** 
 * Replace a path String to "" in logicalDelete.txt.
 * @param regex
 * @param fileName
 * @param replacement
 * @throws IOExceptio
 */
public static void replaceInFile(String oldString,String newString){
  InputStream in=null;
  InputStreamReader inRead=null;
  try {
    in=new FileInputStream(filePath);
    StringBuffer buffer=new StringBuffer();
    inRead=new InputStreamReader(in);
    BufferedReader buf=new BufferedReader(inRead);
    String line;
    String newLine;
    while ((line=buf.readLine()) != null) {
      if (!line.equals(oldString)) {
        newLine=line;
      }
 else {
        newLine=line.replace(oldString,newString);
        for (int i=0; i < delLs.size(); i++) {
          String[] es=(String[])delLs.get(i);
          if ((es[0] + "String_Node_Str" + es[1]).equals(oldString)) {
            delLs.remove(es);
            break;
          }
        }
      }
      if (!newLine.equals(PluginConstant.EMPTY_STRING)) {
        buffer.append(newLine).append("String_Node_Str");
      }
    }
    OutputStream os=new FileOutputStream(filePath);
    os.write(buffer.toString().getBytes());
    os.close();
  }
 catch (  Exception exc) {
    log.error(exc,exc);
  }
 finally {
    try {
      in.close();
      inRead.close();
    }
 catch (    IOException e) {
      log.error(e,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Replace a path String to "" in logicalDelete.txt.
 * @param regex
 * @param fileName
 * @param replacement
 * @throws IOExceptio
 */
public static void replaceInFile(String oldString,String newString){
  File file=new Path(filePath).toFile();
  if (!file.exists()) {
    return;
  }
  InputStream in=null;
  InputStreamReader inRead=null;
  try {
    in=new FileInputStream(filePath);
    StringBuffer buffer=new StringBuffer();
    inRead=new InputStreamReader(in);
    BufferedReader buf=new BufferedReader(inRead);
    String line;
    String newLine;
    while ((line=buf.readLine()) != null) {
      if (!line.equals(oldString)) {
        newLine=line;
      }
 else {
        newLine=line.replace(oldString,newString);
        for (int i=0; i < delLs.size(); i++) {
          String[] es=(String[])delLs.get(i);
          if ((es[0] + "String_Node_Str" + es[1]).equals(oldString)) {
            delLs.remove(es);
            break;
          }
        }
      }
      if (!newLine.equals(PluginConstant.EMPTY_STRING)) {
        buffer.append(newLine).append("String_Node_Str");
      }
    }
    OutputStream os=new FileOutputStream(filePath);
    os.write(buffer.toString().getBytes());
    os.close();
  }
 catch (  Exception exc) {
    log.error(exc,exc);
  }
 finally {
    try {
      in.close();
      inRead.close();
    }
 catch (    IOException e) {
      log.error(e,e);
    }
  }
}
Program: 138803
Project: 138803
Buggy source:
private void saveConnectionInfo() throws DataprofilerCoreException {
  ReturnCode returnCode=ProxyRepositoryViewObject.save(connection);
  if (returnCode.isOk()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + connection.eResource().getURI().toFileString() + "String_Node_Str");
    }
  }
 else {
    throw new DataprofilerCoreException(DefaultMessagesImpl.getString("String_Node_Str",connection.eResource().getURI().toFileString(),returnCode.getMessage()));
  }
}

Fixed version (ground truth):
private void saveConnectionInfo() throws DataprofilerCoreException {
  if (connection != null && connection.eIsProxy()) {
    connection=(Connection)EObjectHelper.resolveObject(connection);
  }
  ReturnCode returnCode=ProxyRepositoryViewObject.save(connection);
  if (returnCode.isOk()) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + connection.eResource().getURI().toFileString() + "String_Node_Str");
    }
  }
 else {
    throw new DataprofilerCoreException(DefaultMessagesImpl.getString("String_Node_Str",connection.eResource().getURI().toFileString(),returnCode.getMessage()));
  }
}
Program: 138805
Project: 138805
Buggy source:
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    Iterator<IMigrationTask> it=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version).iterator();
    while (it.hasNext()) {
      IMigrationTask task=it.next();
      if (isModelTask(task)) {
        ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
        modelTasks.add(task);
      }
 else {
        commonTasks.add(task);
      }
    }
  }
  if (!modelTasks.isEmpty()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
    WorkspaceVersionHelper.storeVersion(versionFile);
  }
}

Fixed version (ground truth):
public void migration(IProgressMonitor monitor){
  List<IMigrationTask> modelTasks=new ArrayList<IMigrationTask>();
  if (versionFile != null && versionFile.exists()) {
    ProductVersion version=WorkspaceVersionHelper.getVesion(new Path(versionFile.getAbsolutePath()));
    Iterator<IMigrationTask> it=MigrationTaskManager.findWorkspaceTaskByType(MigrationTaskType.FILE,version).iterator();
    while (it.hasNext()) {
      IMigrationTask task=it.next();
      if (isModelTask(task)) {
        ((AbstractWorksapceUpdateTask)task).setWorkspacePath(basePath);
        modelTasks.add(task);
      }
 else {
        commonTasks.add(task);
      }
    }
  }
  if (!modelTasks.isEmpty()) {
    MigrationTaskManager.doMigrationTask(modelTasks,monitor);
  }
}
Program: 138806
Project: 138806
Buggy source:
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
 else {
    if (!defFile.exists()) {
      DefinitionHandler.getInstance();
    }
  }
  ResourceService.refreshStructure();
  if (commonTasks != null) {
    MigrationTaskManager.doMigrationTask(commonTasks,monitor);
  }
}

Fixed version (ground truth):
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
 else {
    if (!defFile.exists()) {
      DefinitionHandler.getInstance();
    }
  }
  ResourceService.refreshStructure();
  if (commonTasks != null) {
    MigrationTaskManager.doMigrationTask(commonTasks,monitor);
  }
  ProxyRepositoryViewObject.fetchAllRepositoryViewObjects(true);
}
Program: 138807
Project: 138807
Buggy source:
@Override protected boolean doExecute() throws Exception {
  File anaFolder=getWorkspacePath().append(EResourceConstant.ANALYSIS.getPath()).toFile();
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(anaFolder,fileList,anaFileFilter);
  for (  File file : fileList) {
    if (file.exists()) {
      try {
        String content=FileUtils.readFileToString(file,EMFUtil.ENCODING);
        content=StringUtils.replace(content,"String_Node_Str","String_Node_Str");
        content=StringUtils.replace(content,"String_Node_Str","String_Node_Str");
        FileUtils.writeStringToFile(file,content,EMFUtil.ENCODING);
      }
 catch (      IOException e) {
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
@Override protected boolean doExecute() throws Exception {
  File anaFolder=getWorkspacePath().append(EResourceConstant.ANALYSIS.getPath()).toFile();
  List<File> fileList=new ArrayList<File>();
  FilesUtils.getAllFilesFromFolder(anaFolder,fileList,anaFileFilter);
  for (  File file : fileList) {
    if (file.exists()) {
      try {
        String content=FileUtils.readFileToString(file,EMFUtil.ENCODING);
        content=StringUtils.replace(content,"String_Node_Str","String_Node_Str");
        content=StringUtils.replace(content,"String_Node_Str","String_Node_Str");
        content=StringUtils.replace(content,"String_Node_Str","String_Node_Str");
        FileUtils.writeStringToFile(file,content,EMFUtil.ENCODING);
      }
 catch (      IOException e) {
        return false;
      }
    }
  }
  return true;
}
Program: 138809
Project: 138809
Buggy source:
@Override public void processDelta(final IResourceDelta rootDelta){
  final List<IFile> added=new ArrayList<IFile>();
  final List<IFile> removed=new ArrayList<IFile>();
  IResourceDeltaVisitor visitor=new IResourceDeltaVisitor(){
    public boolean visit(    IResourceDelta delta){
      IResource resource=delta.getResource();
      if (FactoriesUtil.isEmfFile(resource.getFileExtension())) {
        if (delta.getKind() == IResourceDelta.ADDED) {
          added.add((IFile)resource);
        }
        if (delta.getKind() == IResourceDelta.REMOVED) {
          removed.add((IFile)resource);
        }
      }
      return true;
    }
  }
;
  try {
    rootDelta.accept(visitor);
  }
 catch (  CoreException e1) {
    log.error(e1);
  }
  List<Runnable> refreshedRannables=new ArrayList<Runnable>();
  for (  IFile file : removed) {
    try {
      refreshedRannables.add(getDeleteRunnable(file));
    }
 catch (    Exception e) {
      log.error(e);
    }
  }
  for (  IFile file : added) {
    Resource resource=null;
    try {
      resource=RepResourceFileHelper.getInstance().getFileResource(file);
      refreshedRannables.add(getRefreshRunnable(resource));
    }
 catch (    Exception e) {
      log.error(e);
      e.printStackTrace();
    }
  }
  if (refreshedRannables != null && refreshedRannables.size() > 0) {
    postEventExecute(refreshedRannables);
  }
}

Fixed version (ground truth):
@Override public void processDelta(final IResourceDelta rootDelta){
  final List<IFile> added=new ArrayList<IFile>();
  final List<IFile> removed=new ArrayList<IFile>();
  IResourceDeltaVisitor visitor=new IResourceDeltaVisitor(){
    public boolean visit(    IResourceDelta delta){
      IResource resource=delta.getResource();
      if (FactoriesUtil.isEmfFile(resource.getFileExtension())) {
        if (delta.getKind() == IResourceDelta.ADDED) {
          added.add((IFile)resource);
        }
        if (delta.getKind() == IResourceDelta.REMOVED) {
          removed.add((IFile)resource);
        }
      }
      return true;
    }
  }
;
  try {
    rootDelta.accept(visitor);
  }
 catch (  CoreException e1) {
    log.error(e1);
  }
  List<Runnable> refreshedRannables=new ArrayList<Runnable>();
  for (  IFile file : removed) {
    try {
      refreshedRannables.add(getDeleteRunnable(file));
    }
 catch (    Exception e) {
      log.error(e);
    }
  }
  for (  IFile file : added) {
    Resource resource=null;
    try {
      resource=RepResourceFileHelper.getInstance().getFileResource(file);
      if (resource != null && checkResource(resource)) {
        refreshedRannables.add(getRefreshRunnable(resource));
      }
    }
 catch (    Exception e) {
      log.error(e);
      e.printStackTrace();
    }
  }
  if (refreshedRannables != null && refreshedRannables.size() > 0) {
    postEventExecute(refreshedRannables);
  }
}
Program: 138812
Project: 138812
Buggy source:
@Override protected boolean doExecute() throws Exception {
  DQStructureManager manager=DQStructureManager.getInstance();
  IFolder systemIndicatorFoler=manager.createNewFolder(ResourceManager.getIndicatorFolder(),EResourceConstant.SYSTEM_INDICATORS);
  manager.copyFilesToFolder(CorePlugin.getDefault(),DQStructureManager.SYSTEM_INDICATOR_PATH,true,systemIndicatorFoler,null);
  Collection<Analysis> analyses=searchAllAnalysis(ResourceManager.getAnalysisFolder());
  AnalysisWriter analysisWriter=ElementWriterFactory.getInstance().createAnalysisWrite();
  for (  Analysis ana : analyses) {
    for (    Indicator ind : ana.getResults().getIndicators()) {
      updateIndDefinition(ind);
      if (ind instanceof CompositeIndicator) {
        for (        Indicator indLeave : IndicatorHelper.getIndicatorLeaves(ind)) {
          updateIndDefinition(indLeave);
        }
      }
    }
    analysisWriter.save(ana);
  }
  ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME).delete(true,new NullProgressMonitor());
  DefinitionHandler.getInstance().copyDefinitionsIntoFolder(ResourceManager.getLibrariesFolder());
  return true;
}

Fixed version (ground truth):
@Override protected boolean doExecute() throws Exception {
  if (!ResourceManager.getSystemIndicatorFolder().exists()) {
    DQStructureManager manager=DQStructureManager.getInstance();
    IFolder systemIndicatorFoler=manager.createNewFolder(ResourceManager.getIndicatorFolder(),EResourceConstant.SYSTEM_INDICATORS);
    manager.copyFilesToFolder(CorePlugin.getDefault(),DQStructureManager.SYSTEM_INDICATOR_PATH,true,systemIndicatorFoler,null);
  }
  Collection<Analysis> analyses=searchAllAnalysis(ResourceManager.getAnalysisFolder());
  AnalysisWriter analysisWriter=ElementWriterFactory.getInstance().createAnalysisWrite();
  for (  Analysis ana : analyses) {
    for (    Indicator ind : ana.getResults().getIndicators()) {
      updateIndDefinition(ind);
      if (ind instanceof CompositeIndicator) {
        for (        Indicator indLeave : IndicatorHelper.getIndicatorLeaves(ind)) {
          updateIndDefinition(indLeave);
        }
      }
    }
    analysisWriter.save(ana);
  }
  ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME).delete(true,new NullProgressMonitor());
  DefinitionHandler.getInstance().copyDefinitionsIntoFolder(ResourceManager.getLibrariesFolder());
  return true;
}
Program: 138813
Project: 138813
Buggy source:
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
 else {
    if (!defFile.exists()) {
      DefinitionHandler.getInstance();
    }
  }
}

Fixed version (ground truth):
public void finish(ItemRecord[] records,IProgressMonitor monitor) throws IOException, CoreException {
  ItemRecord.clear();
  IFile defFile=ResourceManager.getLibrariesFolder().getFile(DEFINITION_FILE_NAME);
  if (definitionFile != null && definitionFile.exists()) {
    File defintionFile=defFile.getLocation().toFile();
    FilesUtils.copyFile(definitionFile,defintionFile);
  }
 else {
    if (!defFile.exists()) {
      DefinitionHandler.getInstance();
    }
  }
  ResourceService.refreshStructure();
  if (commonTasks != null) {
    MigrationTaskManager.doMigrationTask(commonTasks,monitor);
  }
}
Program: 138816
Project: 138816
Buggy source:
private void copyFileToFolder(InputStream inputStream,String fileName,IFolder folder) throws CoreException {
  if (inputStream == null) {
    return;
  }
  IFile file=folder.getFile(fileName);
  if (!file.exists()) {
    file.create(inputStream,false,null);
    ModelElement modelElement=ModelElementFileFactory.getModelElement(file);
    if (modelElement != null) {
      AElementPersistance writer=ElementWriterFactory.getInstance().create(file.getFileExtension());
      if (writer != null) {
        IPath propPath=file.getFullPath().removeFileExtension().addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION);
        writer.createProperty(modelElement,propPath);
      }
    }
  }
}

Fixed version (ground truth):
private void copyFileToFolder(InputStream inputStream,String fileName,IFolder folder) throws CoreException {
  if (inputStream == null) {
    return;
  }
  IFile file=folder.getFile(fileName);
  if (!file.exists()) {
    file.create(inputStream,false,null);
    ModelElement modelElement=ModelElementFileFactory.getModelElement(file);
    if (modelElement != null) {
      AElementPersistance writer=ElementWriterFactory.getInstance().create(file.getFileExtension());
      if (writer != null) {
        IPath propPath=file.getFullPath().removeFileExtension().addFileExtension(FactoriesUtil.PROPERTIES_EXTENSION);
        writer.createProperty(modelElement,propPath,file.getName());
      }
    }
  }
}
Program: 138817
Project: 138817
Buggy source:
@Override public void run(){
  if (reposViewObj.getType().getKey().equals(ERepositoryObjectType.METADATA_CONNECTIONS.getKey())) {
    ConnectionItemEditorInput connItemEditorInput=new ConnectionItemEditorInput(reposViewObj);
    CorePlugin.getDefault().openEditor(connItemEditorInput,ConnectionEditor.class.getName());
  }
}

Fixed version (ground truth):
@Override public void run(){
  String key=reposViewObj.getType().getKey();
  if (ERepositoryObjectType.METADATA_CONNECTIONS.getKey().equals(key) || ERepositoryObjectType.METADATA_MDMCONNECTION.getKey().equals(key)) {
    ConnectionItemEditorInput connItemEditorInput=new ConnectionItemEditorInput(reposViewObj);
    CorePlugin.getDefault().openEditor(connItemEditorInput,ConnectionEditor.class.getName());
  }
}
Program: 138819
Project: 138819
Buggy source:
/** 
 * DOC qiongli Comment method "resolveObject".
 * @param proxy
 * @return
 */
public static EObject resolveObject(EObject proxy){
  if (proxy != null && proxy.eIsProxy()) {
    ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
    proxy=(ModelElement)EcoreUtil.resolve(proxy,resourceSet);
  }
  return proxy;
}

Fixed version (ground truth):
/** 
 * DOC qiongli Comment method "resolveObject".
 * @param proxy
 * @return
 */
public static EObject resolveObject(EObject proxy){
  if (proxy != null && proxy.eIsProxy()) {
    ResourceSet resourceSet=ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().resourceSet;
    proxy=(EObject)EcoreUtil.resolve(proxy,resourceSet);
  }
  return proxy;
}
Program: 138820
Project: 138820
Buggy source:
/** 
 * DOC bZhou Comment method "getItemPath". This method is to get the entire path of a item. e.g. getItemPath() = Project/TypedPath/StatePath/xxxx.property.
 * @param property
 * @return
 */
public static IPath getItemPath(Property property){
  Item item=property.getItem();
  if (item instanceof TDQItem) {
    TDQItem tdqItem=(TDQItem)item;
    return ResourceManager.getRootProject().getFullPath().append(getItemTypedPath(property)).append(getItemStatePath(property)).append(tdqItem.getFilename());
  }
 else {
    IPath itemFilePath=new Path(property.eResource().getURI().lastSegment()).removeFileExtension().addFileExtension(FactoriesUtil.ITEM_EXTENSION);
    return ResourceManager.getRootProject().getFullPath().append(getItemTypedPath(property)).append(getItemStatePath(property)).append(itemFilePath);
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "getItemPath". This method is to get the entire path of a item. e.g. getItemPath() = Project/TypedPath/StatePath/xxxx.property.
 * @param property
 * @return
 */
public static IPath getItemPath(Property property){
  Item item=property.getItem();
  if (item instanceof TDQItem) {
    TDQItem tdqItem=(TDQItem)item;
    return ResourceManager.getRootProject().getFullPath().append(getItemTypedPath(property)).append(getItemStatePath(property)).append(tdqItem.getFilename());
  }
 else {
    property=(Property)EObjectHelper.resolveObject(property);
    IPath itemFilePath=new Path(property.eResource().getURI().lastSegment()).removeFileExtension().addFileExtension(FactoriesUtil.ITEM_EXTENSION);
    return ResourceManager.getRootProject().getFullPath().append(getItemTypedPath(property)).append(getItemStatePath(property)).append(itemFilePath);
  }
}
Program: 138821
Project: 138821
Buggy source:
/** 
 * DOC bZhou Comment method "extractProjectLabel". This method is to extract the project technical label.
 * @param property
 * @return
 */
public static String extractProjectLabel(Property property){
  User author=property.getAuthor();
  if (author != null && !author.eIsProxy()) {
    InternalEObject iAuthor=(InternalEObject)property.getAuthor();
    Resource projResource=iAuthor.eResource();
    if (projResource != null) {
      IPath projectPath=new Path(projResource.getURI().toFileString());
      Object projOBJ=EObjectHelper.retrieveEObject(projectPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        return project.getTechnicalLabel();
      }
    }
  }
  return ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "extractProjectLabel". This method is to extract the project technical label.
 * @param property
 * @return
 */
public static String extractProjectLabel(Property property){
  User author=property.getAuthor();
  if (author != null && !author.eIsProxy()) {
    InternalEObject iAuthor=(InternalEObject)property.getAuthor();
    Resource projResource=iAuthor.eResource();
    if (projResource != null) {
      IPath projectPath=new Path(projResource.getURI().toFileString());
      if (projectPath.toFile().exists()) {
        Object projOBJ=EObjectHelper.retrieveEObject(projectPath,PropertiesPackage.eINSTANCE.getProject());
        if (projOBJ != null) {
          Project project=(Project)projOBJ;
          return project.getTechnicalLabel();
        }
      }
    }
  }
  return ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
}
Program: 138823
Project: 138823
Buggy source:
/** 
 * DOC bZhou Comment method "checkProject".
 * @return
 */
private boolean checkProject(){
  try {
    List<ItemRecord> allItemRecords=ItemRecord.getAllItemRecords();
    for (    ItemRecord record : allItemRecords) {
      if (record.getProperty() != null) {
        this.projectName=PropertyHelper.extractProjectLabel(record.getProperty());
        break;
      }
    }
    return true;
  }
 catch (  Exception e) {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "checkProject".
 * @return
 */
private boolean checkProject(){
  return projectName != null;
}
Program: 138824
Project: 138824
Buggy source:
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists() || !definitionFile.exists()) {
      return null;
    }
  }
  return new ItemRecord(path.toFile());
}

Fixed version (ground truth):
public ItemRecord computeInput(IPath path){
  setBasePath(path);
  if (path != null) {
    versionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(VERSION_FILE_NAME).toFile();
    definitionFile=path.append(EResourceConstant.LIBRARIES.getPath()).append(DEFINITION_FILE_NAME).toFile();
    if (!versionFile.exists() || !definitionFile.exists()) {
      return null;
    }
    IPath projPath=path.append("String_Node_Str");
    if (projPath.toFile().exists()) {
      Object projOBJ=EObjectHelper.retrieveEObject(projPath,PropertiesPackage.eINSTANCE.getProject());
      if (projOBJ != null) {
        Project project=(Project)projOBJ;
        projectName=project.getTechnicalLabel();
      }
    }
 else {
      projectName=ReponsitoryContextBridge.PROJECT_DEFAULT_NAME;
    }
  }
  return new ItemRecord(path.toFile());
}
Program: 138826
Project: 138826
Buggy source:
/** 
 * DOC bZhou Comment method "isTOPFile".
 * @param file
 * @return
 */
private boolean isValidDirectory(File file){
  if (!file.getName().startsWith("String_Node_Str")) {
    String absolutePath=file.getAbsolutePath();
    for (    EResourceConstant constant : EResourceConstant.getTopConstants()) {
      if (absolutePath.indexOf(constant.getPath()) > 0) {
        if (constant == EResourceConstant.METADATA) {
          return absolutePath.endsWith(constant.getName()) || absolutePath.endsWith(EResourceConstant.DB_CONNECTIONS.getName()) || absolutePath.endsWith(EResourceConstant.MDM_CONNECTIONS.getName());
        }
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * DOC bZhou Comment method "isTOPFile".
 * @param file
 * @return
 */
private boolean isValidDirectory(File file){
  if (!file.getName().startsWith("String_Node_Str")) {
    IPath filePath=new Path(file.getAbsolutePath());
    for (    EResourceConstant constant : EResourceConstant.getTopConstants()) {
      if (filePath.toString().indexOf(constant.getPath()) > 0) {
        if (constant == EResourceConstant.METADATA) {
          String lastSeg=filePath.lastSegment();
          return lastSeg.equals(constant.getName()) || lastSeg.equals(EResourceConstant.DB_CONNECTIONS.getName()) || lastSeg.equals(EResourceConstant.MDM_CONNECTIONS.getName());
        }
        return true;
      }
    }
  }
  return false;
}