Program: 117897
Project: 117897
Buggy source:
@Override public List<String> extractArgumentSegments(){
  List<String> list=new ArrayList<>();
  list.add(ProcessorConstants.CMD_KEY_WORD_LIBJAR);
  StringBuffer libJars=new StringBuffer();
  Set<String> libNames=new HashSet<>();
  boolean isExport=isExportConfig() || isRunAsExport();
  if (process instanceof IProcess2) {
    if (isExport) {
      libNames=JavaProcessorUtilities.extractLibNamesOnlyForMapperAndReducer((IProcess2)process);
    }
 else {
      libNames=JavaProcessorUtilities.extractLibNamesOnlyForMapperAndReducerWithoutRoutines((IProcess2)process);
    }
  }
  Set<ModuleNeeded> modulesNeeded=LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(process.getId(),process.getVersion());
  Set<String> allNeededLibsAfterAdjuster=new HashSet<String>();
  for (  ModuleNeeded module : modulesNeeded) {
    allNeededLibsAfterAdjuster.add(module.getModuleName());
  }
  Iterator<String> it=libNames.iterator();
  while (it.hasNext()) {
    String jarName=it.next();
    if (!allNeededLibsAfterAdjuster.contains(jarName)) {
      it.remove();
    }
  }
  File libDir=JavaProcessorUtilities.getJavaProjectLibFolder();
  File targetDir=new File(JavaProcessorUtilities.getTalendJavaProject().getTargetFolder().getLocationURI());
  String libFolder="String_Node_Str";
  if (libDir != null) {
    libFolder=new Path(libDir.getAbsolutePath()).toPortableString();
  }
  if (libNames != null && libNames.size() > 0) {
    Iterator<String> itLibNames=libNames.iterator();
    while (itLibNames.hasNext()) {
      if (isExport) {
        libJars.append(getLibFolderInWorkingDir() + itLibNames.next()).append(',');
      }
 else {
        libJars.append(libFolder + "String_Node_Str" + itLibNames.next()).append(',');
      }
    }
  }
  if (isExport) {
    libJars.append("String_Node_Str" + makeupJobJarName());
  }
 else {
    Set<FilterInfo> codeJars=new HashSet<>();
    codeJars.add(new FilterInfo(JavaUtils.ROUTINE_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    codeJars.add(new FilterInfo(JavaUtils.BEANS_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    codeJars.add(new FilterInfo(JavaUtils.PIGUDFS_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    List<File> files=FileUtils.getAllFilesFromFolder(targetDir,codeJars);
    boolean routinesHaveBeenFound=false;
    for (    File f : files) {
      if (!routinesHaveBeenFound && f.getName().startsWith(JavaUtils.ROUTINE_JAR_NAME)) {
        routinesHaveBeenFound=true;
      }
      libJars.append(new Path(f.getAbsolutePath()).toPortableString() + "String_Node_Str");
    }
    if (!routinesHaveBeenFound) {
      File routinesJar=new File(targetDir + "String_Node_Str" + JavaUtils.ROUTINE_JAR_NAME+ "String_Node_Str"+ PomUtil.getDefaultMavenVersion()+ FileExtensions.JAR_FILE_SUFFIX);
      libJars.append(new Path(routinesJar.getAbsolutePath()).toPortableString() + "String_Node_Str");
    }
    if (targetDir != null) {
      libJars.append(new Path(targetDir.getAbsolutePath()).toPortableString() + "String_Node_Str" + makeupJobJarName());
    }
  }
  list.add(libJars.toString());
  return list;
}

Fixed version (ground truth):
@Override public List<String> extractArgumentSegments(){
  List<String> list=new ArrayList<>();
  list.add(ProcessorConstants.CMD_KEY_WORD_LIBJAR);
  StringBuffer libJars=new StringBuffer();
  Set<String> libNames=new HashSet<>();
  boolean isExport=isExportConfig() || isRunAsExport();
  if (process instanceof IProcess2) {
    if (isExport) {
      libNames=JavaProcessorUtilities.extractLibNamesOnlyForMapperAndReducer((IProcess2)process);
    }
 else {
      libNames=JavaProcessorUtilities.extractLibNamesOnlyForMapperAndReducerWithoutRoutines((IProcess2)process);
    }
  }
  Set<ModuleNeeded> modulesNeeded=LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(process.getId(),process.getVersion());
  Set<String> allNeededLibsAfterAdjuster=new HashSet<String>();
  for (  ModuleNeeded module : modulesNeeded) {
    allNeededLibsAfterAdjuster.add(module.getModuleName());
  }
  Iterator<String> it=libNames.iterator();
  while (it.hasNext()) {
    String jarName=it.next();
    if (!allNeededLibsAfterAdjuster.contains(jarName) && !JavaUtils.ROUTINES_JAR.equals(jarName) && !JavaUtils.BEANS_JAR.equals(jarName)&& !JavaUtils.PIGUDFS_JAR.equals(jarName)) {
      it.remove();
    }
  }
  File libDir=JavaProcessorUtilities.getJavaProjectLibFolder();
  File targetDir=new File(JavaProcessorUtilities.getTalendJavaProject().getTargetFolder().getLocationURI());
  String libFolder="String_Node_Str";
  if (libDir != null) {
    libFolder=new Path(libDir.getAbsolutePath()).toPortableString();
  }
  if (libNames != null && libNames.size() > 0) {
    Iterator<String> itLibNames=libNames.iterator();
    while (itLibNames.hasNext()) {
      if (isExport) {
        libJars.append(getLibFolderInWorkingDir() + itLibNames.next()).append(',');
      }
 else {
        libJars.append(libFolder + "String_Node_Str" + itLibNames.next()).append(',');
      }
    }
  }
  if (isExport) {
    libJars.append("String_Node_Str" + makeupJobJarName());
  }
 else {
    Set<FilterInfo> codeJars=new HashSet<>();
    codeJars.add(new FilterInfo(JavaUtils.ROUTINE_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    codeJars.add(new FilterInfo(JavaUtils.BEANS_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    codeJars.add(new FilterInfo(JavaUtils.PIGUDFS_JAR_NAME,FileExtensions.JAR_FILE_SUFFIX));
    List<File> files=FileUtils.getAllFilesFromFolder(targetDir,codeJars);
    boolean routinesHaveBeenFound=false;
    for (    File f : files) {
      if (!routinesHaveBeenFound && f.getName().startsWith(JavaUtils.ROUTINE_JAR_NAME)) {
        routinesHaveBeenFound=true;
      }
      libJars.append(new Path(f.getAbsolutePath()).toPortableString() + "String_Node_Str");
    }
    if (!routinesHaveBeenFound) {
      File routinesJar=new File(targetDir + "String_Node_Str" + JavaUtils.ROUTINE_JAR_NAME+ "String_Node_Str"+ PomUtil.getDefaultMavenVersion()+ FileExtensions.JAR_FILE_SUFFIX);
      libJars.append(new Path(routinesJar.getAbsolutePath()).toPortableString() + "String_Node_Str");
    }
    if (targetDir != null) {
      libJars.append(new Path(targetDir.getAbsolutePath()).toPortableString() + "String_Node_Str" + makeupJobJarName());
    }
  }
  list.add(libJars.toString());
  return list;
}