nus-yam/ex-repair huggingface dataset:
Program: 120908
Project: 120908
Buggy source:
protected void addSourceCode(ExportFileResource[] allResources,ProcessItem processItem,boolean needSource,ExportFileResource resource,String... selectedJobVersion){
  if (!needSource) {
    return;
  }
  try {
    String projectName=getCorrespondingProjectName(processItem);
    String jobName=processItem.getProperty().getLabel();
    String jobVersion=processItem.getProperty().getVersion();
    if (!isMultiNodes() && selectedJobVersion != null && selectedJobVersion.length == 1) {
      jobVersion=selectedJobVersion[0];
    }
    String jobFolderName=JavaResourcesHelper.getJobFolderName(jobName,jobVersion);
    IPath path=getSrcRootLocation();
    path=path.append(projectName).append(jobFolderName);
    FilenameFilter filter=new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.toLowerCase().endsWith("String_Node_Str");
      }
    }
;
    List<URL> javaFileUrls=new ArrayList<URL>();
    File file=path.toFile();
    if (file.exists() && file.isDirectory()) {
      for (      File curFile : file.listFiles(filter)) {
        javaFileUrls.add(FileLocator.toFileURL(curFile.toURL()));
      }
    }
    resource.addResources(JOB_SOURCE_FOLDER_NAME + PATH_SEPARATOR + projectName+ PATH_SEPARATOR+ jobFolderName,javaFileUrls);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
protected void addSourceCode(ExportFileResource[] allResources,ProcessItem processItem,boolean needSource,ExportFileResource resource,String... selectedJobVersion){
  if (!needSource) {
    return;
  }
  try {
    String projectName=getCorrespondingProjectName(processItem);
    String jobName=processItem.getProperty().getLabel();
    String jobVersion=processItem.getProperty().getVersion();
    if (!isMultiNodes() && selectedJobVersion != null && selectedJobVersion.length == 1) {
      jobVersion=selectedJobVersion[0];
    }
    String jobFolderName=JavaResourcesHelper.getJobFolderName(jobName,jobVersion);
    IPath path=getSrcRootLocation();
    path=path.append(projectName).append(jobFolderName);
    FilenameFilter filter=new FilenameFilter(){
      @Override public boolean accept(      File dir,      String name){
        return name.toLowerCase().endsWith("String_Node_Str");
      }
    }
;
    List<URL> javaFileUrls=new ArrayList<URL>();
    File file=path.toFile();
    if (file.exists() && file.isDirectory()) {
      for (      File curFile : file.listFiles(filter)) {
        javaFileUrls.add(FileLocator.toFileURL(curFile.toURL()));
      }
    }
    resource.addResources(JOB_SOURCE_FOLDER_NAME + PATH_SEPARATOR + projectName+ PATH_SEPARATOR+ jobFolderName,javaFileUrls);
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 120909
Project: 120909
Buggy source:
protected List<URL> getLib(List<String> libs,Boolean needLib){
  List<URL> list=new ArrayList<URL>();
  if (!needLib) {
    return list;
  }
  try {
    org.talend.core.model.general.Project projecdddt=ProjectManager.getInstance().getCurrentProject();
    IProject fsProject=null;
    try {
      fsProject=ResourceModelUtils.getProject(projecdddt);
    }
 catch (    PersistenceException e2) {
      ExceptionHandler.process(e2);
    }
    IPath temPath=fsProject.getLocation().append(File.separator + "String_Node_Str");
    ILibraryManagerService repositoryBundleService=CorePlugin.getDefault().getRepositoryBundleService();
    if (repositoryBundleService != null) {
      repositoryBundleService.retrieve(libs,temPath.toString());
    }
    File file=temPath.toFile();
    File[] files=file.listFiles(new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX) || name.toLowerCase().endsWith(FileConstants.PROPERTIES_FILE_SUFFIX) || name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
      }
    }
);
    for (    File tempFile : files) {
      try {
        if (libs.contains(tempFile.getName())) {
          list.add(tempFile.toURL());
        }
      }
 catch (      MalformedURLException e) {
        ExceptionHandler.process(e);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return list;
}

Fixed version (ground truth):
protected List<URL> getLib(List<String> libs,Boolean needLib){
  List<URL> list=new ArrayList<URL>();
  if (!needLib) {
    return list;
  }
  try {
    org.talend.core.model.general.Project projecdddt=ProjectManager.getInstance().getCurrentProject();
    IProject fsProject=null;
    try {
      fsProject=ResourceModelUtils.getProject(projecdddt);
    }
 catch (    PersistenceException e2) {
      ExceptionHandler.process(e2);
    }
    IPath temPath=fsProject.getLocation().append(File.separator + "String_Node_Str");
    ILibraryManagerService repositoryBundleService=CorePlugin.getDefault().getRepositoryBundleService();
    if (repositoryBundleService != null) {
      repositoryBundleService.retrieve(libs,temPath.toString());
    }
    File file=temPath.toFile();
    File[] files=file.listFiles(new FilenameFilter(){
      @Override public boolean accept(      File dir,      String name){
        return name.toLowerCase().endsWith(FileConstants.JAR_FILE_SUFFIX) || name.toLowerCase().endsWith(FileConstants.PROPERTIES_FILE_SUFFIX) || name.toLowerCase().endsWith(FileConstants.ZIP_FILE_SUFFIX) ? true : false;
      }
    }
);
    for (    File tempFile : files) {
      try {
        if (libs.contains(tempFile.getName())) {
          list.add(tempFile.toURL());
        }
      }
 catch (      MalformedURLException e) {
        ExceptionHandler.process(e);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
  return list;
}
Program: 120910
Project: 120910
Buggy source:
private Collection<File> getAllFiles(File rootFile,String childPath){
  final Collection<File> list=new ArrayList<File>();
  new File(rootFile,childPath).listFiles(new java.io.FilenameFilter(){
    public boolean accept(    java.io.File dir,    String name){
      File file=new java.io.File(dir,name);
      if (file.isFile()) {
        list.add(file);
        return true;
      }
      return false;
    }
  }
);
  return list;
}

Fixed version (ground truth):
private Collection<File> getAllFiles(File rootFile,String childPath){
  final Collection<File> list=new ArrayList<File>();
  new File(rootFile,childPath).listFiles(new java.io.FilenameFilter(){
    @Override public boolean accept(    java.io.File dir,    String name){
      File file=new java.io.File(dir,name);
      if (file.isFile()) {
        list.add(file);
        return true;
      }
      return false;
    }
  }
);
  return list;
}
Program: 120911
Project: 120911
Buggy source:
protected void addMavenDependencyElements(Document pomDocument,Set<ModuleNeeded> neededModules,String libFolder){
  Element rootElement=pomDocument.getRootElement();
  Element parentEle=rootElement.element(IMavenProperties.ELE_DEPENDENCIES);
  if (parentEle == null) {
    parentEle=rootElement.addElement(IMavenProperties.ELE_DEPENDENCIES);
  }
  removeComments(parentEle);
  List<ModuleNeeded> modelesList=new ArrayList<ModuleNeeded>();
  modelesList.addAll(neededModules);
  Collections.sort(modelesList,new Comparator<ModuleNeeded>(){
    public int compare(    ModuleNeeded m1,    ModuleNeeded m2){
      return m1.getModuleName().compareToIgnoreCase(m2.getModuleName());
    }
  }
);
  for (  ModuleNeeded module : modelesList) {
    addMavenDependencyElement(parentEle,module.getModuleName(),libFolder);
  }
}

Fixed version (ground truth):
protected void addMavenDependencyElements(Document pomDocument,Set<ModuleNeeded> neededModules,String libFolder){
  Element rootElement=pomDocument.getRootElement();
  Element parentEle=rootElement.element(IMavenProperties.ELE_DEPENDENCIES);
  if (parentEle == null) {
    parentEle=rootElement.addElement(IMavenProperties.ELE_DEPENDENCIES);
  }
  removeComments(parentEle);
  List<ModuleNeeded> modelesList=new ArrayList<ModuleNeeded>();
  modelesList.addAll(neededModules);
  Collections.sort(modelesList,new Comparator<ModuleNeeded>(){
    @Override public int compare(    ModuleNeeded m1,    ModuleNeeded m2){
      return m1.getModuleName().compareToIgnoreCase(m2.getModuleName());
    }
  }
);
  for (  ModuleNeeded module : modelesList) {
    addMavenDependencyElement(parentEle,module.getModuleName(),libFolder);
  }
}
Program: 120912
Project: 120912
Buggy source:
/** 
 * DOC ycbai Comment method "getJobScriptsUncompressed".
 * @param resource
 * @param process
 * @throws IOException
 */
private void getJobScriptsUncompressed(ExportFileResource resource,ProcessItem process) throws IOException {
  String projectName=getCorrespondingProjectName(process);
  final URI classRootURI=classesLocation.toURI();
  List<String> jobFolderNames=getRelatedJobFolderNames(process);
  try {
    final String classRootLocation=getClassRootLocation() + projectName + File.separator;
    for (    String jobFolderName : jobFolderNames) {
      String classRoot=FilesUtils.getFileRealPath(classRootLocation + jobFolderName);
      String targetPath=FilesUtils.getFileRealPath(classesLocation + File.separator + projectName+ File.separator+ jobFolderName);
      File sourceFile=new File(classRoot);
      File targetFile=new File(targetPath);
      FilesUtils.copyFolder(sourceFile,targetFile,true,null,null,true,false);
      List<URL> fileURLs=FilesUtils.getFileURLs(targetFile);
      for (      URL url : fileURLs) {
        resource.addResource(classRootURI.relativize(new File(url.toURI()).getParentFile().toURI()).toString(),url);
      }
    }
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getJobScriptsUncompressed".
 * @param resource
 * @param process
 * @throws IOException
 */
private void getJobScriptsUncompressed(ExportFileResource resource,ProcessItem process) throws IOException {
  final URI classRootURI=classesLocation.toURI();
  List<String> jobFolderNames=getRelatedJobFolderNames(process);
  try {
    for (    String jobFolderName : jobFolderNames) {
      String[] jf=jobFolderName.split("String_Node_Str");
      String projectName=jf[0];
      String folderName=jf[1];
      String classRootLocation=getClassRootLocation() + projectName + File.separator;
      String classRoot=FilesUtils.getFileRealPath(classRootLocation + folderName);
      String targetPath=FilesUtils.getFileRealPath(classesLocation + File.separator + projectName+ File.separator+ folderName);
      File sourceFile=new File(classRoot);
      File targetFile=new File(targetPath);
      FilesUtils.copyFolder(sourceFile,targetFile,true,null,null,true,false);
      List<URL> fileURLs=FilesUtils.getFileURLs(targetFile);
      for (      URL url : fileURLs) {
        resource.addResource(classRootURI.relativize(new File(url.toURI()).getParentFile().toURI()).toString(),url);
      }
    }
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 120913
Project: 120913
Buggy source:
@Override protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        String trim=ARG_DELIMITER.trim();
        if (value.trim().startsWith(trim)) {
          return value;
        }
        return trim + value;
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}

Fixed version (ground truth):
@Override protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        return value.replace("String_Node_Str","String_Node_Str");
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}
Program: 120914
Project: 120914
Buggy source:
@Override protected List<String> readString(String stringList){
  if (stringList == null || "String_Node_Str".equals(stringList)) {
    return EMPTY_STRING_LIST;
  }
  ArrayList<String> result=new ArrayList<String>(50);
  for (  String tmp : stringList.split(ARG_DELIMITER)) {
    if (tmp != null && !"String_Node_Str".equals(tmp)) {
      result.add(tmp);
    }
  }
  return result;
}

Fixed version (ground truth):
@Override protected List<String> readString(String stringList){
  if (stringList == null || "String_Node_Str".equals(stringList)) {
    return EMPTY_STRING_LIST;
  }
  ArrayList<String> result=new ArrayList<String>(50);
  for (  String tmp : stringList.split("String_Node_Str")) {
    if (tmp != null && !"String_Node_Str".equals(tmp)) {
      result.add(tmp);
    }
  }
  return result;
}
Program: 120915
Project: 120915
Buggy source:
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    String trim=ARG_DELIMITER.trim();
    if (value.trim().startsWith(trim)) {
      return value;
    }
    return trim + value;
  }
  throw new IllegalStateException();
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    return value.replace("String_Node_Str","String_Node_Str");
  }
  throw new IllegalStateException();
}
Program: 120916
Project: 120916
Buggy source:
@Override protected String writeString(List<String> items){
  int size=items.size();
  StringBuffer buf=new StringBuffer(size * 50);
  if (size > 0) {
    buf.append(ARG_DELIMITER);
  }
  for (int i=0; i < size; i++) {
    buf.append(items.get(i));
    if (i != size - 1) {
      String trim=ARG_DELIMITER.trim();
      if (!items.get(i + 1).trim().startsWith(trim)) {
        buf.append(ARG_DELIMITER);
      }
 else {
        buf.append("String_Node_Str");
      }
    }
  }
  return buf.toString();
}

Fixed version (ground truth):
@Override protected String writeString(List<String> items){
  int size=items.size();
  StringBuffer buf=new StringBuffer(size * 50);
  buf.append("String_Node_Str");
  for (int i=0; i < size; i++) {
    buf.append(items.get(i).trim().replaceAll("String_Node_Str","String_Node_Str"));
    buf.append("String_Node_Str");
  }
  return buf.toString();
}
Program: 120917
Project: 120917
Buggy source:
protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        return value;
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}

Fixed version (ground truth):
protected ITableLabelProvider createLabelProvider(){
  return new ITableLabelProvider(){
    public Image getColumnImage(    Object element,    int columnIndex){
      return null;
    }
    public String getColumnText(    Object element,    int columnIndex){
      String value=((String)element);
      if (columnIndex == 0) {
        return value.replace("String_Node_Str","String_Node_Str");
      }
      throw new IllegalStateException();
    }
    public void addListener(    ILabelProviderListener listener){
    }
    public void dispose(){
    }
    public boolean isLabelProperty(    Object element,    String property){
      return false;
    }
    public void removeListener(    ILabelProviderListener listener){
    }
  }
;
}
Program: 120918
Project: 120918
Buggy source:
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing);
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value.replaceAll("String_Node_Str","String_Node_Str"));
    viewer.refresh();
    doSave();
  }
}

Fixed version (ground truth):
protected void editItem(ISelection sel){
  IStructuredSelection selection=(IStructuredSelection)sel;
  String existing=(String)selection.getFirstElement();
  String value=getExistingInputObject(existing.replace("String_Node_Str","String_Node_Str"));
  if (value != null) {
    int indexOf=list.indexOf(existing);
    list.remove(existing);
    list.add(indexOf,value);
    viewer.refresh();
    doSave();
  }
}
Program: 120919
Project: 120919
Buggy source:
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    return value;
  }
  throw new IllegalStateException();
}

Fixed version (ground truth):
public String getColumnText(Object element,int columnIndex){
  String value=((String)element);
  if (columnIndex == 0) {
    return value.replace("String_Node_Str","String_Node_Str");
  }
  throw new IllegalStateException();
}
Program: 120920
Project: 120920
Buggy source:
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  CSVReader rdr=new CSVReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId));
  List<String> resultHeader=rdr.nextRecord();
  int resultCols=resultHeader.size();
  List<String> row;
  while ((row=rdr.nextRecord()) != null) {
    resultInfo=new HashMap<String,String>();
    for (int i=0; i < resultCols; i++) {
      resultInfo.put(resultHeader.get(i),row.get(i));
    }
    resultInfoList.add(resultInfo);
  }
  return resultInfoList;
}

Fixed version (ground truth):
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  baseFileReader=new com.talend.csv.CSVReader(new java.io.BufferedReader(new java.io.InputStreamReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId),FILE_ENCODING)),',');
  if (baseFileReader.readNext()) {
    baseFileHeader=Arrays.asList(baseFileReader.getValues());
  }
  baseFileHeaderSize=baseFileHeader.size();
  String[] row;
  while (baseFileReader.readNext()) {
    if ((row=baseFileReader.getValues()) != null) {
      resultInfo=new HashMap<String,String>();
      for (int i=0; i < baseFileHeaderSize; i++) {
        resultInfo.put(baseFileHeader.get(i),row[i]);
      }
      resultInfoList.add(resultInfo);
    }
  }
  return resultInfoList;
}
Program: 120921
Project: 120921
Buggy source:
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  CSVReader rdr=new CSVReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId));
  List<String> resultHeader=rdr.nextRecord();
  int resultCols=resultHeader.size();
  List<String> row;
  while ((row=rdr.nextRecord()) != null) {
    resultInfo=new HashMap<String,String>();
    for (int i=0; i < resultCols; i++) {
      resultInfo.put(resultHeader.get(i),row.get(i));
    }
    resultInfoList.add(resultInfo);
  }
  return resultInfoList;
}

Fixed version (ground truth):
public List<Map<String,String>> getQueryResult(String resultId) throws AsyncApiException, IOException {
  List<Map<String,String>> resultInfoList=new ArrayList<Map<String,String>>();
  Map<String,String> resultInfo;
  baseFileReader=new com.talend.csv.CSVReader(new java.io.BufferedReader(new java.io.InputStreamReader(connection.getQueryResultStream(job.getId(),batchInfoList.get(0).getId(),resultId),FILE_ENCODING)),',');
  if (baseFileReader.readNext()) {
    baseFileHeader=Arrays.asList(baseFileReader.getValues());
  }
  baseFileHeaderSize=baseFileHeader.size();
  String[] row;
  while (baseFileReader.readNext()) {
    if ((row=baseFileReader.getValues()) != null) {
      resultInfo=new HashMap<String,String>();
      for (int i=0; i < baseFileHeaderSize; i++) {
        resultInfo.put(baseFileHeader.get(i),row[i]);
      }
      resultInfoList.add(resultInfo);
    }
  }
  return resultInfoList;
}
Program: 120922
Project: 120922
Buggy source:
protected List<String> getRelatedJobFolderNames(ProcessItem process,Set<String> jobNameVersionChecked){
  List<String> jobFolderNames=new ArrayList<String>();
  String jobName=process.getProperty().getLabel();
  String jobVersion=process.getProperty().getVersion();
  String id=jobName + "String_Node_Str" + jobVersion;
  if (jobNameVersionChecked.contains(id)) {
    return jobFolderNames;
  }
  jobNameVersionChecked.add(id);
  String jobFolderName=JavaResourcesHelper.getJobFolderName(jobName,jobVersion);
  jobFolderNames.add(jobFolderName);
  Set<JobInfo> subjobInfos=ProcessorUtilities.getChildrenJobInfo(process);
  for (  JobInfo subjobInfo : subjobInfos) {
    jobFolderNames.addAll(getRelatedJobFolderNames(subjobInfo.getProcessItem(),jobNameVersionChecked));
  }
  return jobFolderNames;
}

Fixed version (ground truth):
protected List<String> getRelatedJobFolderNames(ProcessItem process,Set<String> jobNameVersionChecked){
  List<String> jobFolderNames=new ArrayList<String>();
  String projectName=getCorrespondingProjectName(process);
  String jobName=process.getProperty().getLabel();
  String jobVersion=process.getProperty().getVersion();
  String id=projectName + "String_Node_Str" + jobName+ "String_Node_Str"+ jobVersion;
  if (jobNameVersionChecked.contains(id)) {
    return jobFolderNames;
  }
  jobNameVersionChecked.add(id);
  String jobFolderName=JavaResourcesHelper.getJobFolderName(jobName,jobVersion);
  jobFolderNames.add(projectName + "String_Node_Str" + jobFolderName);
  Set<JobInfo> subjobInfos=ProcessorUtilities.getChildrenJobInfo(process);
  for (  JobInfo subjobInfo : subjobInfos) {
    jobFolderNames.addAll(getRelatedJobFolderNames(subjobInfo.getProcessItem(),jobNameVersionChecked));
  }
  return jobFolderNames;
}
Program: 120923
Project: 120923
Buggy source:
/** 
 * DOC ycbai Comment method "getJobScriptsUncompressed".
 * @param resource
 * @param process
 * @throws IOException
 */
private void getJobScriptsUncompressed(ExportFileResource resource,ProcessItem process) throws IOException {
  String projectName=getCorrespondingProjectName(process);
  final URI classRootURI=classesLocation.toURI();
  List<String> jobFolderNames=getRelatedJobFolderNames(process);
  try {
    final String classRootLocation=getClassRootLocation() + projectName + File.separator;
    for (    String jobFolderName : jobFolderNames) {
      String classRoot=FilesUtils.getFileRealPath(classRootLocation + jobFolderName);
      String targetPath=FilesUtils.getFileRealPath(classesLocation + File.separator + projectName+ File.separator+ jobFolderName);
      File sourceFile=new File(classRoot);
      File targetFile=new File(targetPath);
      FilesUtils.copyFolder(sourceFile,targetFile,true,null,null,true,false);
      List<URL> fileURLs=FilesUtils.getFileURLs(targetFile);
      for (      URL url : fileURLs) {
        resource.addResource(classRootURI.relativize(new File(url.toURI()).getParentFile().toURI()).toString(),url);
      }
    }
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "getJobScriptsUncompressed".
 * @param resource
 * @param process
 * @throws IOException
 */
private void getJobScriptsUncompressed(ExportFileResource resource,ProcessItem process) throws IOException {
  final URI classRootURI=classesLocation.toURI();
  List<String> jobFolderNames=getRelatedJobFolderNames(process);
  try {
    for (    String jobFolderName : jobFolderNames) {
      String[] jf=jobFolderName.split("String_Node_Str");
      String projectName=jf[0];
      String folderName=jf[1];
      String classRootLocation=getClassRootLocation() + projectName + File.separator;
      String classRoot=FilesUtils.getFileRealPath(classRootLocation + folderName);
      String targetPath=FilesUtils.getFileRealPath(classesLocation + File.separator + projectName+ File.separator+ folderName);
      File sourceFile=new File(classRoot);
      File targetFile=new File(targetPath);
      FilesUtils.copyFolder(sourceFile,targetFile,true,null,null,true,false);
      List<URL> fileURLs=FilesUtils.getFileURLs(targetFile);
      for (      URL url : fileURLs) {
        resource.addResource(classRootURI.relativize(new File(url.toURI()).getParentFile().toURI()).toString(),url);
      }
    }
  }
 catch (  IOException e) {
    throw e;
  }
catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}
Program: 120924
Project: 120924
Buggy source:
private void createPopupMenu(){
  MenuManager menuMgr=new MenuManager("String_Node_Str");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager mgr){
      BusinessAssignment businessAssignment=getBusinessAssignment(tableViewer.getSelection());
      if (businessAssignment != null) {
        repositoryNode=createRepositoryNode(businessAssignment);
        if (repositoryNode != null) {
          List<ITreeContextualAction> contextualsActions=ActionsHelper.getRepositoryContextualsActions();
          for (          ITreeContextualAction action : contextualsActions) {
            if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
              action.init(null,new StructuredSelection(repositoryNode));
              if (action.isVisible()) {
                ((AContextualAction)action).setAvoidUnloadResources(true);
                mgr.add(action);
              }
            }
          }
        }
        CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr,tableViewer.getSelection());
      }
    }
  }
);
  Menu menu=menuMgr.createContextMenu(tableViewer.getControl());
  tableViewer.getControl().setMenu(menu);
}

Fixed version (ground truth):
private void createPopupMenu(){
  MenuManager menuMgr=new MenuManager("String_Node_Str");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener(){
    @Override public void menuAboutToShow(    IMenuManager mgr){
      BusinessAssignment businessAssignment=getBusinessAssignment(tableViewer.getSelection());
      if (businessAssignment != null) {
        repositoryNode=createRepositoryNode(businessAssignment);
        if (repositoryNode != null) {
          List<ITreeContextualAction> contextualsActions=ActionsHelper.getRepositoryContextualsActions();
          for (          ITreeContextualAction action : contextualsActions) {
            if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
              action.init(null,new StructuredSelection(repositoryNode));
              if (action.isVisible()) {
                ((AContextualAction)action).setAvoidUnloadResources(true);
                mgr.add(action);
              }
            }
          }
          if (ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
            CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr,tableViewer.getSelection());
          }
        }
      }
    }
  }
);
  Menu menu=menuMgr.createContextMenu(tableViewer.getControl());
  tableViewer.getControl().setMenu(menu);
}
Program: 120925
Project: 120925
Buggy source:
@Override public void menuAboutToShow(IMenuManager mgr){
  BusinessAssignment businessAssignment=getBusinessAssignment(tableViewer.getSelection());
  if (businessAssignment != null) {
    repositoryNode=createRepositoryNode(businessAssignment);
    if (repositoryNode != null) {
      List<ITreeContextualAction> contextualsActions=ActionsHelper.getRepositoryContextualsActions();
      for (      ITreeContextualAction action : contextualsActions) {
        if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
          action.init(null,new StructuredSelection(repositoryNode));
          if (action.isVisible()) {
            ((AContextualAction)action).setAvoidUnloadResources(true);
            mgr.add(action);
          }
        }
      }
    }
    CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr,tableViewer.getSelection());
  }
}

Fixed version (ground truth):
@Override public void menuAboutToShow(IMenuManager mgr){
  BusinessAssignment businessAssignment=getBusinessAssignment(tableViewer.getSelection());
  if (businessAssignment != null) {
    repositoryNode=createRepositoryNode(businessAssignment);
    if (repositoryNode != null) {
      List<ITreeContextualAction> contextualsActions=ActionsHelper.getRepositoryContextualsActions();
      for (      ITreeContextualAction action : contextualsActions) {
        if (action.isReadAction() || action.isEditAction() || action.isPropertiesAction()) {
          action.init(null,new StructuredSelection(repositoryNode));
          if (action.isVisible()) {
            ((AContextualAction)action).setAvoidUnloadResources(true);
            mgr.add(action);
          }
        }
      }
      if (ProjectManager.getInstance().isInCurrentMainProject(repositoryNode)) {
        CorePlugin.getDefault().getDiagramModelService().addDeleteAssignmentAction(mgr,tableViewer.getSelection());
      }
    }
  }
}
Program: 120927
Project: 120927
Buggy source:
public boolean hasChildren(Object element){
  return getChildren(element).length > 0;
}

Fixed version (ground truth):
@Override public boolean hasChildren(Object element){
  return getChildren(element).length > 0;
}
Program: 120928
Project: 120928
Buggy source:
public String getColumnText(Object element,int columnIndex){
  RepositoryNode node=(RepositoryNode)element;
  if (columnIndex == 0) {
    return ((SqlBuilderRepositoryObject)node.getObject()).getSourceName();
  }
 else   if (columnIndex == 1) {
    return ((SqlBuilderRepositoryObject)node.getObject()).getRepositoryName();
  }
  return null;
}

Fixed version (ground truth):
@Override public String getColumnText(Object element,int columnIndex){
  RepositoryNode node=(RepositoryNode)element;
  if (columnIndex == 0) {
    return ((SqlBuilderRepositoryObject)node.getObject()).getSourceName();
  }
 else   if (columnIndex == 1) {
    return ((SqlBuilderRepositoryObject)node.getObject()).getRepositoryName();
  }
  return null;
}
Program: 120929
Project: 120929
Buggy source:
public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}

Fixed version (ground truth):
@Override public void inputChanged(Viewer viewer,Object oldInput,Object newInput){
}
Program: 120930
Project: 120930
Buggy source:
public Object getParent(Object element){
  RepositoryNode node=(RepositoryNode)element;
  final RepositoryNode parent=node.getParent();
  if (parent != null) {
    return parent;
  }
 else {
    return node;
  }
}

Fixed version (ground truth):
@Override public Object getParent(Object element){
  RepositoryNode node=(RepositoryNode)element;
  final RepositoryNode parent=node.getParent();
  if (parent != null) {
    return parent;
  }
 else {
    return node;
  }
}
Program: 120931
Project: 120931
Buggy source:
private void createQuery(RepositoryNode queriesConnectionNode,IRepositoryViewObject repObj,QueriesConnection queriesConnection){
  displayQueries.clear();
  for (Iterator iter=queriesConnection.getQuery().iterator(); iter.hasNext(); ) {
    Query query=(Query)iter.next();
    QueryRepositoryObject repositoryObject=new QueryRepositoryObject(repObj,query);
    repositoryObject.setImage(IMAGES_SQL_EDITOR_ICON);
    repositoryObject.setSourceName(query.getLabel());
    RepositoryNode node=new RepositoryNodeExt(repositoryObject,queriesConnectionNode,ENodeType.REPOSITORY_ELEMENT);
    node.setProperties(EProperties.CONTENT_TYPE,RepositoryNodeType.QUERY);
    queriesConnectionNode.getChildren().add(node);
    if (connectionParameters.getQueryObject() != null && query.getLabel().equals(connectionParameters.getQueryObject().getLabel())) {
      this.selectedExtReposiotryNode=node;
    }
    displayQueries.add(query);
  }
}

Fixed version (ground truth):
private void createQuery(RepositoryNode queriesConnectionNode,IRepositoryViewObject repObj,QueriesConnection queriesConnection){
  displayQueries.clear();
  for (  Object element : queriesConnection.getQuery()) {
    Query query=(Query)element;
    boolean isDelete=SubItemHelper.isDeleted(query);
    boolean isReadOnly=connectionParameters.isNodeReadOnly();
    if (isDelete && !isReadOnly) {
      continue;
    }
    QueryRepositoryObject repositoryObject=new QueryRepositoryObject(repObj,query);
    repositoryObject.setImage(IMAGES_SQL_EDITOR_ICON);
    repositoryObject.setSourceName(query.getLabel());
    RepositoryNode node=new RepositoryNodeExt(repositoryObject,queriesConnectionNode,ENodeType.REPOSITORY_ELEMENT);
    node.setProperties(EProperties.CONTENT_TYPE,RepositoryNodeType.QUERY);
    queriesConnectionNode.getChildren().add(node);
    if (connectionParameters.getQueryObject() != null && query.getLabel().equals(connectionParameters.getQueryObject().getLabel())) {
      this.selectedExtReposiotryNode=node;
    }
    displayQueries.add(query);
  }
}
Program: 120932
Project: 120932
Buggy source:
public Property getProperty(){
  return repObj.getProperty();
}

Fixed version (ground truth):
@Override public Property getProperty(){
  return repObj.getProperty();
}
Program: 120933
Project: 120933
Buggy source:
public Color getForeground(Object element,int columnIndex){
  return null;
}

Fixed version (ground truth):
@Override public Color getForeground(Object element,int columnIndex){
  return null;
}
Program: 120934
Project: 120934
Buggy source:
@SuppressWarnings("String_Node_Str") public Object[] getChildren(Object parentElement){
  if (isRefresh) {
    RepositoryNode repositoryNode=(RepositoryNode)parentElement;
    RepositoryNode rootNode=repositoryNodeManager.getRoot(repositoryNode);
    refreshRootNode(rootNode);
    rootNode.getChildren().clear();
    DatabaseConnection metadataConnection=(DatabaseConnection)((ConnectionItem)repositoryNode.getObject().getProperty().getItem()).getConnection();
    boolean isBuildIn=((SqlBuilderRepositoryObject)rootNode.getObject()).isBuildIn();
    createTables(rootNode,rootNode.getObject(),metadataConnection,isBuildIn);
    createQueries(rootNode,rootNode.getObject(),metadataConnection,isBuildIn);
    isRefresh=false;
    return repositoryNode.getChildren().toArray();
  }
 else {
    return ((RepositoryNode)parentElement).getChildren().toArray();
  }
}

Fixed version (ground truth):
@Override @SuppressWarnings("String_Node_Str") public Object[] getChildren(Object parentElement){
  if (isRefresh) {
    RepositoryNode repositoryNode=(RepositoryNode)parentElement;
    RepositoryNode rootNode=repositoryNodeManager.getRoot(repositoryNode);
    refreshRootNode(rootNode);
    rootNode.getChildren().clear();
    DatabaseConnection metadataConnection=(DatabaseConnection)((ConnectionItem)repositoryNode.getObject().getProperty().getItem()).getConnection();
    boolean isBuildIn=((SqlBuilderRepositoryObject)rootNode.getObject()).isBuildIn();
    createTables(rootNode,rootNode.getObject(),metadataConnection,isBuildIn);
    createQueries(rootNode,rootNode.getObject(),metadataConnection,isBuildIn);
    isRefresh=false;
    return repositoryNode.getChildren().toArray();
  }
 else {
    return ((RepositoryNode)parentElement).getChildren().toArray();
  }
}
Program: 120935
Project: 120935
Buggy source:
public Image getColumnImage(Object element,int columnIndex){
  RepositoryNode node=(RepositoryNode)element;
  SqlBuilderRepositoryObject repositoryObject=(SqlBuilderRepositoryObject)node.getObject();
  if (columnIndex == 1) {
    return null;
  }
 else   if (columnIndex == 2) {
    if ((repositoryObject).getDiffImage() == null) {
      return null;
    }
    return ImageUtil.getImage((repositoryObject).getDiffImage());
  }
  return ImageUtil.getImage((repositoryObject).getImage());
}

Fixed version (ground truth):
@Override public Image getColumnImage(Object element,int columnIndex){
  RepositoryNode node=(RepositoryNode)element;
  SqlBuilderRepositoryObject repositoryObject=(SqlBuilderRepositoryObject)node.getObject();
  if (columnIndex == 1) {
    return null;
  }
 else   if (columnIndex == 2) {
    if ((repositoryObject).getDiffImage() == null) {
      return null;
    }
    return ImageUtil.getImage((repositoryObject).getDiffImage());
  }
  return ImageUtil.getImage((repositoryObject).getImage());
}
Program: 120936
Project: 120936
Buggy source:
public Object[] getElements(Object inputElement){
  if (!(inputElement instanceof RepositoryNode)) {
    return new Object[0];
  }
  RepositoryNode treeRoot=(RepositoryNode)inputElement;
  if (!isInitialized) {
    initialize(treeRoot);
    isInitialized=true;
  }
  return treeRoot.getChildren().toArray();
}

Fixed version (ground truth):
@Override public Object[] getElements(Object inputElement){
  if (!(inputElement instanceof RepositoryNode)) {
    return new Object[0];
  }
  RepositoryNode treeRoot=(RepositoryNode)inputElement;
  if (!isInitialized) {
    initialize(treeRoot);
    isInitialized=true;
  }
  return treeRoot.getChildren().toArray();
}
Program: 120937
Project: 120937
Buggy source:
public Color getBackground(Object element,int columnIndex){
  RepositoryNode repositoryNode=(RepositoryNode)element;
  SqlBuilderRepositoryObject repositoryObject=(SqlBuilderRepositoryObject)repositoryNode.getObject();
  if (columnIndex == 2) {
    return null;
  }
 else {
    return colors.get((repositoryObject).getColor());
  }
}

Fixed version (ground truth):
@Override public Color getBackground(Object element,int columnIndex){
  RepositoryNode repositoryNode=(RepositoryNode)element;
  SqlBuilderRepositoryObject repositoryObject=(SqlBuilderRepositoryObject)repositoryNode.getObject();
  if (columnIndex == 2) {
    return null;
  }
 else {
    return colors.get((repositoryObject).getColor());
  }
}
Program: 120938
Project: 120938
Buggy source:
/** 
 * method "deleteQueries" use delete Queries.
 * @param repositoryNode databaseConnection's RepositoryNode
 * @param queries need to deleted Queries
 */
@SuppressWarnings("String_Node_Str") public void deleteQueries(RepositoryNode repositoryNode,List<Query> queries){
  DatabaseConnectionItem item=getItem(repositoryNode);
  DatabaseConnection connection=(DatabaseConnection)item.getConnection();
  QueriesConnection queriesConnection=connection.getQueries();
  if (queriesConnection != null) {
    List<Query> qs=queriesConnection.getQuery();
    List<Query> qs2=new ArrayList<Query>();
    qs2.clear();
    for (    Query query : qs) {
      boolean flag=true;
      for (      Query q : queries) {
        if (query.getLabel().equals(q.getLabel())) {
          flag=false;
        }
      }
      if (flag) {
        qs2.add(query);
      }
    }
    queriesConnection.getQuery().clear();
    queriesConnection.getQuery().addAll(qs2);
  }
  deleteEMFQueries(repositoryNode.getObject().getId(),queries);
}

Fixed version (ground truth):
/** 
 * method "deleteQueries" use delete Queries.
 * @param repositoryNode databaseConnection's RepositoryNode
 * @param queries need to deleted Queries
 */
public void deleteQueries(RepositoryNode repositoryNode,List<Query> queries){
  DatabaseConnectionItem item=getEMFItem(repositoryNode.getObject().getId());
  for (  Query query : queries) {
    SubItemHelper.setDeleted(query,true);
  }
  saveMetaData(item);
}
Program: 120939
Project: 120939
Buggy source:
/** 
 * Comment method "createContent".
 * @param child
 */
private void createContent(Composite mainComposite){
  header=new HeaderComposite(mainComposite,SWT.NONE);
  if (this.foxManager.isNoLoopInComponent()) {
    header.updateStatus(Messages.getString("String_Node_Str"));
  }
  xmlToSchemaSash=new SashForm(mainComposite,SWT.HORIZONTAL | SWT.SMOOTH);
  xmlToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
  xmlToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
  canModify=externalNode.getProcess().isReadOnly();
  if (externalNode.getOriginalNode().getJobletNode() != null) {
    canModify=externalNode.getOriginalNode().isReadOnly();
  }
  IElementParameter elem=externalNode.getElementParameter("String_Node_Str");
  if (elem != null) {
    String value=(String)elem.getValue();
    if (value != null && value.equals("String_Node_Str")) {
      isRepository=true;
    }
  }
  addSchemaViewer(xmlToSchemaSash,300,110);
  addXMLViewer(xmlToSchemaSash,400,110);
  xmlToSchemaSash.setWeights(new int[]{40,60});
  linker=new Schema2XMLLinker(this.xmlToSchemaSash);
  linker.init(schemaViewer.getTable(),xmlViewer);
  linker.setManager(foxManager);
  initSchemaTable();
  new FooterComposite(mainComposite,SWT.NONE,foxManager);
  xmlViewer.expandToLevel(3);
  linker.createLinks();
}

Fixed version (ground truth):
/** 
 * Comment method "createContent".
 * @param child
 */
private void createContent(Composite mainComposite){
  header=new HeaderComposite(mainComposite,SWT.NONE);
  if (this.foxManager.isNoLoopInComponent()) {
    header.updateStatus(Messages.getString("String_Node_Str"));
  }
  xmlToSchemaSash=new SashForm(mainComposite,SWT.HORIZONTAL | SWT.SMOOTH);
  xmlToSchemaSash.setLayoutData(new GridData(GridData.FILL_BOTH));
  xmlToSchemaSash.setBackgroundMode(SWT.INHERIT_FORCE);
  canModify=externalNode.getProcess().isReadOnly();
  if (externalNode.getOriginalNode().getJobletNode() != null) {
    canModify=externalNode.getOriginalNode().isReadOnly();
  }
  IElementParameter elem=externalNode.getElementParameter("String_Node_Str");
  if (elem != null) {
    String value=(String)elem.getValue();
    if (value != null && value.equals("String_Node_Str")) {
      isRepository=true;
    }
  }
  addSchemaViewer(xmlToSchemaSash,300,110);
  addXMLViewer(xmlToSchemaSash,400,110);
  xmlToSchemaSash.setWeights(new int[]{40,60});
  linker=new Schema2XMLLinker(this.xmlToSchemaSash);
  linker.init(schemaViewer.getTable(),xmlViewer);
  linker.setManager(foxManager);
  initSchemaTable();
  footerComp=new FooterComposite(mainComposite,SWT.NONE,foxManager);
  xmlViewer.expandToLevel(3);
  linker.createLinks();
}
Program: 120940
Project: 120940
Buggy source:
private void addSchemaViewer(final Composite mainComposite,final int width,final int height){
  final Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  createCombo(group);
  schemaViewer=new TableViewer(group);
  SchemaTableViewerProvider provider=new SchemaTableViewerProvider();
  schemaViewer.setContentProvider(provider);
  schemaViewer.setLabelProvider(provider);
  GridData data2=new GridData(GridData.FILL_BOTH);
  Table table=schemaViewer.getTable();
  if (canModify || isRepository) {
    table.setEnabled(false);
  }
  table.setHeaderVisible(true);
  TableColumn column1=new TableColumn(table,SWT.LEFT);
  column1.setText(Messages.getString("String_Node_Str"));
  column1.setWidth(100);
  table.setLayoutData(data2);
}

Fixed version (ground truth):
private void addSchemaViewer(final Composite mainComposite,final int width,final int height){
  final Group group=Form.createGroup(mainComposite,1,Messages.getString("String_Node_Str"),height);
  createCombo(group);
  schemaViewer=new TableViewer(group);
  SchemaTableViewerProvider provider=new SchemaTableViewerProvider();
  schemaViewer.setContentProvider(provider);
  schemaViewer.setLabelProvider(provider);
  GridData data2=new GridData(GridData.FILL_BOTH);
  Table table=schemaViewer.getTable();
  if (canModify || isRepository) {
    table.setEnabled(false);
  }
  table.setHeaderVisible(true);
  TableColumn column1=new TableColumn(table,SWT.LEFT);
  column1.setText(Messages.getString("String_Node_Str"));
  column1.setWidth(100);
  table.setLayoutData(data2);
  table.addSelectionListener(new SelectionAdapter(){
    @Override public void widgetSelected(    SelectionEvent e){
      if (footerComp != null) {
        footerComp.isActivateBtn(false);
      }
    }
  }
);
}
Program: 120942
Project: 120942
Buggy source:
public void widgetDefaultSelected(SelectionEvent e){
}

Fixed version (ground truth):
@Override public void widgetDefaultSelected(SelectionEvent e){
}
Program: 120943
Project: 120943
Buggy source:
public void widgetSelected(SelectionEvent e){
  foxManager.getUiManager().autoMap();
}

Fixed version (ground truth):
@Override public void widgetSelected(SelectionEvent e){
  foxManager.getUiManager().autoMap();
}
Program: 120945
Project: 120945
Buggy source:
public String[] getSurrogateCreationTypeNames(){
  List<String> allTypeNames=new ArrayList<String>();
  IElementParameter param=getComponent().getElementParameter(EParameterName.SK_CREATION.getName());
  for (  SurrogateCreationType type : SurrogateCreationType.values()) {
    if (param != null) {
      if (ArrayUtils.contains(param.getListItemsDisplayCodeName(),type.name())) {
        allTypeNames.add(type.getName());
      }
    }
 else     allTypeNames.add(type.getName());
  }
  return allTypeNames.toArray(new String[0]);
}

Fixed version (ground truth):
public String[] getSurrogateCreationTypeNames(){
  List<String> allTypeNames=new ArrayList<String>();
  IElementParameter param=getComponent().getElementParameter(EParameterName.SK_CREATION.getName());
  for (  SurrogateCreationType type : SurrogateCreationType.values()) {
    if (param != null) {
      if (ArrayUtils.contains(param.getListItemsDisplayCodeName(),type.name())) {
        allTypeNames.add(type.getName());
      }
    }
 else {
      allTypeNames.add(type.getName());
    }
  }
  return allTypeNames.toArray(new String[0]);
}
Program: 120947
Project: 120947
Buggy source:
/** 
 * Build Root Nodes List.
 * @return
 */
@SuppressWarnings("String_Node_Str") public void buildRootNodes(IProcess process){
  rootNodes=new ArrayList<INode>();
  List<INode> preJobsNode=(List<INode>)process.getNodesOfType("String_Node_Str");
  for (  INode node : preJobsNode) {
    if (node.isActivate()) {
      rootNodes.add(node);
    }
  }
  for (  INode node : nodes) {
    String componentName=node.getComponent().getName();
    if ((node.isStart()) && (node.isActivate()) && (!componentName.equals("String_Node_Str"))&& (!componentName.equals("String_Node_Str"))) {
      rootNodes.add(node);
    }
  }
  List<INode> postJobsNode=(List<INode>)process.getNodesOfType("String_Node_Str");
  for (  INode node : postJobsNode) {
    if (node.isActivate()) {
      rootNodes.add(node);
    }
  }
}

Fixed version (ground truth):
/** 
 * Build Root Nodes List.
 * @return
 */
@SuppressWarnings("String_Node_Str") public void buildRootNodes(IProcess process){
  rootNodes=new ArrayList<INode>();
  List<INode> preJobsNode=(List<INode>)process.getNodesOfType("String_Node_Str");
  for (  INode node : preJobsNode) {
    if (node.isActivate()) {
      rootNodes.add(node);
    }
  }
  for (  INode node : nodes) {
    String componentName=node.getComponent().getName();
    if ((node.isStart()) && (node.isActivate()) && node.isSubtreeStart()&& (!componentName.equals("String_Node_Str"))&& (!componentName.equals("String_Node_Str"))) {
      rootNodes.add(node);
    }
  }
  List<INode> postJobsNode=(List<INode>)process.getNodesOfType("String_Node_Str");
  for (  INode node : postJobsNode) {
    if (node.isActivate()) {
      rootNodes.add(node);
    }
  }
}