Program: 119124
Project: 119124
Buggy source:
/** 
 * DOC zli Comment method "getLauncher".
 * @param needLauncher
 * @param setParameterValues used for context_param to export
 * @param process
 * @param contextName
 * @param environment
 * @param statisticPort
 * @param tracePort
 * @param codeOptions
 * @return
 */
protected List<URL> getLauncher(boolean needLauncher,boolean setParameterValues,ProcessItem process,String contextName,String environment,int statisticPort,int tracePort,String... codeOptions){
  List<URL> list=new ArrayList<URL>();
  if (!needLauncher) {
    return list;
  }
  String processId=process.getProperty().getId();
  String windowsCmd=getCommandByTalendJob(Platform.OS_WIN32,processId,contextName,process.getProperty().getVersion(),statisticPort,tracePort,codeOptions);
  String unixCmd=getCommandByTalendJob(Platform.OS_LINUX,processId,contextName,process.getProperty().getVersion(),statisticPort,tracePort,codeOptions);
  if (setParameterValues) {
    String contextParameterValues=getSettingContextParametersValue();
    if (windowsCmd.contains(CMDFORWIN) && windowsCmd.indexOf(CMDFORWIN) > 2) {
      windowsCmd=windowsCmd.substring(0,windowsCmd.indexOf(CMDFORWIN) - 1) + contextParameterValues + CMDFORWIN;
    }
    if (unixCmd.contains(CMDFORUNIX) && unixCmd.indexOf(CMDFORUNIX) > 2) {
      unixCmd=unixCmd.substring(0,unixCmd.indexOf(CMDFORUNIX) - 1) + contextParameterValues + CMDFORUNIX;
    }
  }
  String tmpFold=getTmpFolder();
  if (environment.equals(ALL_ENVIRONMENTS)) {
    createLauncherFile(process,list,unixCmd,UNIX_LAUNCHER,tmpFold);
    createLauncherFile(process,list,windowsCmd,WINDOWS_LAUNCHER,tmpFold);
  }
 else   if (environment.equals(UNIX_ENVIRONMENT)) {
    createLauncherFile(process,list,unixCmd,UNIX_LAUNCHER,tmpFold);
  }
 else   if (environment.equals(WINDOWS_ENVIRONMENT)) {
    createLauncherFile(process,list,windowsCmd,WINDOWS_LAUNCHER,tmpFold);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * @deprecated seems never used, so deprecated first.
 */
protected List<URL> getLauncher(boolean needLauncher,boolean setParameterValues,ProcessItem process,String contextName,String environment,int statisticPort,int tracePort,String... codeOptions){
  List<URL> list=new ArrayList<URL>();
  if (!needLauncher) {
    return list;
  }
  String processId=process.getProperty().getId();
  String windowsCmd=getCommandByTalendJob(Platform.OS_WIN32,processId,contextName,process.getProperty().getVersion(),statisticPort,tracePort,codeOptions);
  String unixCmd=getCommandByTalendJob(Platform.OS_LINUX,processId,contextName,process.getProperty().getVersion(),statisticPort,tracePort,codeOptions);
  if (setParameterValues) {
    String contextParameterValues=getSettingContextParametersValue();
    if (windowsCmd.contains(CMDFORWIN) && windowsCmd.indexOf(CMDFORWIN) > 2) {
      windowsCmd=windowsCmd.substring(0,windowsCmd.indexOf(CMDFORWIN) - 1) + contextParameterValues + CMDFORWIN;
    }
    if (unixCmd.contains(CMDFORUNIX) && unixCmd.indexOf(CMDFORUNIX) > 2) {
      unixCmd=unixCmd.substring(0,unixCmd.indexOf(CMDFORUNIX) - 1) + contextParameterValues + CMDFORUNIX;
    }
  }
  String tmpFold=getTmpFolder();
  if (environment.equals(ALL_ENVIRONMENTS)) {
    createLauncherFile(process,list,unixCmd,UNIX_LAUNCHER,tmpFold);
    createLauncherFile(process,list,windowsCmd,WINDOWS_LAUNCHER,tmpFold);
  }
 else   if (environment.equals(UNIX_ENVIRONMENT)) {
    createLauncherFile(process,list,unixCmd,UNIX_LAUNCHER,tmpFold);
  }
 else   if (environment.equals(WINDOWS_ENVIRONMENT)) {
    createLauncherFile(process,list,windowsCmd,WINDOWS_LAUNCHER,tmpFold);
  }
  return list;
}