Program: 125575
Project: 125575
Buggy source:
private static void generateContextInfo(JobInfo jobInfo,String selectedContextName,boolean statistics,boolean trace,boolean needContext,IProgressMonitor progressMonitor,IProcess currentProcess,String currentJobName,IProcessor processor) throws ProcessorException {
  if (isCodeGenerationNeeded(jobInfo,statistics,trace)) {
    codeModified=true;
    if ((currentProcess instanceof IProcess2) && exportConfig) {
      ((IProcess2)currentProcess).setProcessModified(true);
      resetRunJobComponentParameterForContextApply(jobInfo,currentProcess,selectedContextName);
    }
    progressMonitor.subTask(Messages.getString("String_Node_Str") + currentJobName);
    IContext currentContext;
    if (jobInfo.getContext() == null) {
      currentContext=getContext(currentProcess,jobInfo.getContextName());
    }
 else {
      currentContext=jobInfo.getContext();
    }
    if (needContext) {
      List<IContext> list=currentProcess.getContextManager().getListContext();
      for (      IContext context : list) {
        if (context.getName().equals(currentContext.getName())) {
          processor.setContext(currentContext);
        }
 else {
          processor.setContext(context);
        }
        LastGenerationInfo.getInstance().getContextPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).add(context.getName());
        try {
          processor.generateContextCode();
        }
 catch (        ProcessorException pe) {
          ExceptionHandler.process(pe);
        }
      }
    }
    processor.setContext(currentContext);
    processor.generateCode(statistics,trace,true);
    if (currentProcess instanceof IProcess2 && ((IProcess2)currentProcess).getProperty() != null) {
      designerCoreService.getLastGeneratedJobsDateMap().put(currentProcess.getId(),((IProcess2)currentProcess).getProperty().getModificationDate());
    }
    Integer infos=new Integer(0);
    infos+=statistics ? GENERATED_WITH_STATS : 0;
    infos+=trace ? GENERATED_WITH_TRACES : 0;
    lastGeneratedWithStatsOrTrace.put(jobInfo.getJobId(),infos);
    if (currentProcess instanceof IProcess2) {
      processor.generateEsbFiles();
      ((IProcess2)currentProcess).setNeedRegenerateCode(false);
    }
  }
 else {
    processor.setCodeGenerated(true);
  }
}

Fixed version (ground truth):
private static void generateContextInfo(JobInfo jobInfo,String selectedContextName,boolean statistics,boolean trace,boolean needContext,IProgressMonitor progressMonitor,IProcess currentProcess,String currentJobName,IProcessor processor,boolean isMain) throws ProcessorException {
  if (isCodeGenerationNeeded(jobInfo,statistics,trace)) {
    codeModified=true;
    if ((currentProcess instanceof IProcess2) && exportConfig) {
      ((IProcess2)currentProcess).setProcessModified(true);
      resetRunJobComponentParameterForContextApply(jobInfo,currentProcess,selectedContextName);
    }
    progressMonitor.subTask(Messages.getString("String_Node_Str") + currentJobName);
    IContext currentContext;
    if (jobInfo.getContext() == null) {
      currentContext=getContext(currentProcess,jobInfo.getContextName());
    }
 else {
      currentContext=jobInfo.getContext();
    }
    if (needContext) {
      List<IContext> list=currentProcess.getContextManager().getListContext();
      for (      IContext context : list) {
        if (context.getName().equals(currentContext.getName())) {
          processor.setContext(currentContext);
        }
 else {
          processor.setContext(context);
        }
        LastGenerationInfo.getInstance().getContextPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).add(context.getName());
        try {
          processor.generateContextCode();
        }
 catch (        ProcessorException pe) {
          ExceptionHandler.process(pe);
        }
      }
    }
    processor.setContext(currentContext);
    int option=TalendProcessOptionConstants.GENERATE_WITHOUT_FORMAT;
    if (isMain) {
      option=0;
    }
    processor.generateCode(statistics,trace,true,option);
    if (currentProcess instanceof IProcess2 && ((IProcess2)currentProcess).getProperty() != null) {
      designerCoreService.getLastGeneratedJobsDateMap().put(currentProcess.getId(),((IProcess2)currentProcess).getProperty().getModificationDate());
    }
    Integer infos=new Integer(0);
    infos+=statistics ? GENERATED_WITH_STATS : 0;
    infos+=trace ? GENERATED_WITH_TRACES : 0;
    lastGeneratedWithStatsOrTrace.put(jobInfo.getJobId(),infos);
    if (currentProcess instanceof IProcess2) {
      processor.generateEsbFiles();
      ((IProcess2)currentProcess).setNeedRegenerateCode(false);
    }
  }
 else {
    processor.setCodeGenerated(true);
  }
}