Program: 117931
Project: 117931
Buggy source:
public IStatus doRun(){
  try {
    TimeMeasure.display=CommonsPlugin.isDebugMode();
    TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
    TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
    TimeMeasure.begin("String_Node_Str");
    jetFilesCompileFail.clear();
    IProgressMonitor monitorWrap=null;
    monitorWrap=new NullProgressMonitor();
    ECodeLanguage codeLanguage=LanguageManager.getCurrentLanguage();
    initializeJetEmittersProject(monitorWrap);
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    CodeGeneratorInternalTemplatesFactory templatesFactory=CodeGeneratorInternalTemplatesFactoryProvider.getInstance();
    templatesFactory.setCurrentLanguage(codeLanguage);
    templatesFactory.init();
    IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
    long startTime=System.currentTimeMillis();
    defaultTemplate=templatesFactory.getTemplatesFromType(EInternalTemplate.DEFAULT_TEMPLATE).get(0).getTemplateRelativeUri();
    List<JetBean> jetBeans=new ArrayList<JetBean>();
    List<TemplateUtil> templates=templatesFactory.getTemplates();
    Set<IComponent> components=componentsFactory.getComponents();
    List<IComponent> genericComponents=new ArrayList<IComponent>();
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    monitorWrap.beginTask(Messages.getString("String_Node_Str"),(2 * templates.size() + 5 * components.size()));
    int monitorBuffer=0;
    for (    TemplateUtil template : templates) {
      JetBean jetBean=initializeUtilTemplate(template,codeLanguage);
      jetBeans.add(jetBean);
      monitorBuffer++;
      if (monitorBuffer % 100 == 0) {
        monitorWrap.worked(100);
        monitorBuffer=0;
      }
    }
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    if (components != null) {
      ECodePart codePart=ECodePart.MAIN;
      for (      IComponent component : new ArrayList<IComponent>(components)) {
        if (EComponentType.GENERIC.equals(component.getComponentType())) {
          genericComponents.add(component);
          continue;
        }
        if (component.getAvailableCodeParts().size() > 0) {
          initComponent(codeLanguage,jetBeans,codePart,component);
        }
        monitorBuffer++;
        if (monitorBuffer % 100 == 0) {
          monitorWrap.worked(100);
          monitorBuffer=0;
        }
      }
    }
    for (    IComponent genericComponent : genericComponents) {
      initGenericComponent(codeLanguage,jetBeans,ECodePart.BEGIN,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.END,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.MAIN,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.FINALLY,genericComponent);
      break;
    }
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    monitorWrap.worked(monitorBuffer);
    initializeEmittersPool(jetBeans,codeLanguage,monitorWrap);
    monitorWrap.done();
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    if (!CommonUIPlugin.isFullyHeadless()) {
      if (firstTime) {
        Job job=new Job(Messages.getString("String_Node_Str")){
          @Override protected IStatus run(          IProgressMonitor monitor){
            CorePlugin.getDefault().getDesignerCoreService().synchronizeDesignerUI(new PropertyChangeEvent(this,IComponentConstants.NORMAL,null,null));
            return Status.OK_STATUS;
          }
        }
;
        job.setUser(true);
        job.setPriority(Job.INTERACTIVE);
        job.schedule();
        job.wakeUp();
        firstTime=false;
      }
    }
    log.debug(Messages.getString("String_Node_Str",(System.currentTimeMillis() - startTime)));
    initialized=true;
    ComponentCompilations.addMarkers();
    initializeStart=false;
  }
 catch (  Exception e) {
    log.error(Messages.getString("String_Node_Str"),e);
    TimeMeasure.end("String_Node_Str");
    TimeMeasure.display=false;
    TimeMeasure.displaySteps=false;
    TimeMeasure.measureActive=false;
    return new Status(IStatus.ERROR,CodeGeneratorActivator.PLUGIN_ID,Messages.getString("String_Node_Str"),e);
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  if (jetFilesCompileFail.size() > 0) {
    StringBuilder message=new StringBuilder();
    for (    JetBean tmpJetBean : jetFilesCompileFail) {
      if (message.length() > 0) {
        message.append("String_Node_Str").append(tmpJetBean.getTemplateRelativeUri());
      }
 else {
        message.append(tmpJetBean.getTemplateRelativeUri());
      }
    }
    return new Status(IStatus.ERROR,CodeGeneratorActivator.PLUGIN_ID,Messages.getString("String_Node_Str") + message.toString());
  }
  if (!CommonsPlugin.isHeadless()) {
    CorePlugin.getDefault().getRcpService().activeSwitchProjectAction();
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doRun(){
  try {
    TimeMeasure.display=CommonsPlugin.isDebugMode();
    TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
    TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
    TimeMeasure.begin("String_Node_Str");
    jetFilesCompileFail.clear();
    IProgressMonitor monitorWrap=null;
    monitorWrap=new NullProgressMonitor();
    ECodeLanguage codeLanguage=LanguageManager.getCurrentLanguage();
    initializeJetEmittersProject(monitorWrap);
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    CodeGeneratorInternalTemplatesFactory templatesFactory=CodeGeneratorInternalTemplatesFactoryProvider.getInstance();
    templatesFactory.setCurrentLanguage(codeLanguage);
    templatesFactory.init();
    IComponentsFactory componentsFactory=ComponentsFactoryProvider.getInstance();
    long startTime=System.currentTimeMillis();
    defaultTemplate=templatesFactory.getTemplatesFromType(EInternalTemplate.DEFAULT_TEMPLATE).get(0).getTemplateRelativeUri();
    List<JetBean> jetBeans=new ArrayList<JetBean>();
    List<TemplateUtil> templates=templatesFactory.getTemplates();
    Collection<IComponent> components=componentsFactory.readComponents();
    List<IComponent> genericComponents=new ArrayList<IComponent>();
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    monitorWrap.beginTask(Messages.getString("String_Node_Str"),(2 * templates.size() + 5 * components.size()));
    int monitorBuffer=0;
    for (    TemplateUtil template : templates) {
      JetBean jetBean=initializeUtilTemplate(template,codeLanguage);
      jetBeans.add(jetBean);
      monitorBuffer++;
      if (monitorBuffer % 100 == 0) {
        monitorWrap.worked(100);
        monitorBuffer=0;
      }
    }
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    if (components != null) {
      ECodePart codePart=ECodePart.MAIN;
      for (      IComponent component : components) {
        if (EComponentType.GENERIC.equals(component.getComponentType())) {
          genericComponents.add(component);
          continue;
        }
        if (component.getAvailableCodeParts().size() > 0) {
          initComponent(codeLanguage,jetBeans,codePart,component);
        }
        monitorBuffer++;
        if (monitorBuffer % 100 == 0) {
          monitorWrap.worked(100);
          monitorBuffer=0;
        }
      }
    }
    for (    IComponent genericComponent : genericComponents) {
      initGenericComponent(codeLanguage,jetBeans,ECodePart.BEGIN,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.END,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.MAIN,genericComponent);
      initGenericComponent(codeLanguage,jetBeans,ECodePart.FINALLY,genericComponent);
      break;
    }
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    monitorWrap.worked(monitorBuffer);
    initializeEmittersPool(jetBeans,codeLanguage,monitorWrap);
    monitorWrap.done();
    TimeMeasure.step("String_Node_Str","String_Node_Str");
    if (!CommonUIPlugin.isFullyHeadless()) {
      if (firstTime) {
        Job job=new Job(Messages.getString("String_Node_Str")){
          @Override protected IStatus run(          IProgressMonitor monitor){
            CorePlugin.getDefault().getDesignerCoreService().synchronizeDesignerUI(new PropertyChangeEvent(this,IComponentConstants.NORMAL,null,null));
            return Status.OK_STATUS;
          }
        }
;
        job.setUser(true);
        job.setPriority(Job.INTERACTIVE);
        job.schedule();
        job.wakeUp();
        firstTime=false;
      }
    }
    log.debug(Messages.getString("String_Node_Str",(System.currentTimeMillis() - startTime)));
    initialized=true;
    ComponentCompilations.addMarkers();
    initializeStart=false;
  }
 catch (  Exception e) {
    log.error(Messages.getString("String_Node_Str"),e);
    TimeMeasure.end("String_Node_Str");
    TimeMeasure.display=false;
    TimeMeasure.displaySteps=false;
    TimeMeasure.measureActive=false;
    return new Status(IStatus.ERROR,CodeGeneratorActivator.PLUGIN_ID,Messages.getString("String_Node_Str"),e);
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  if (jetFilesCompileFail.size() > 0) {
    StringBuilder message=new StringBuilder();
    for (    JetBean tmpJetBean : jetFilesCompileFail) {
      if (message.length() > 0) {
        message.append("String_Node_Str").append(tmpJetBean.getTemplateRelativeUri());
      }
 else {
        message.append(tmpJetBean.getTemplateRelativeUri());
      }
    }
    return new Status(IStatus.ERROR,CodeGeneratorActivator.PLUGIN_ID,Messages.getString("String_Node_Str") + message.toString());
  }
  if (!CommonsPlugin.isHeadless()) {
    CorePlugin.getDefault().getRcpService().activeSwitchProjectAction();
  }
  return Status.OK_STATUS;
}