Program: 118257
Project: 118257
Buggy source:
@Override public void generateCode(boolean statistics,boolean trace,boolean javaProperties) throws ProcessorException {
  super.generateCode(statistics,trace,javaProperties);
  try {
    String currentJavaProject=ProjectManager.getInstance().getProject(property).getTechnicalLabel();
    ICodeGenerator codeGen;
    ICodeGeneratorService service=RunProcessPlugin.getDefault().getCodeGeneratorService();
    if (javaProperties) {
      String javaInterpreter="String_Node_Str";
      String javaLib="String_Node_Str";
      String javaContext=getContextPath().toPortableString();
      codeGen=service.createCodeGenerator(process,statistics,trace,javaInterpreter,javaLib,javaContext,currentJavaProject);
    }
 else {
      codeGen=service.createCodeGenerator(process,statistics,trace);
    }
    if (!process.getContextManager().getDefaultContext().getName().equals(context.getName())) {
      boolean found=false;
      for (      IContext c : process.getContextManager().getListContext()) {
        if (c.getName().equals(context.getName())) {
          found=true;
        }
      }
      if (found) {
        codeGen.setContextName(context.getName());
      }
    }
    String processCode="String_Node_Str";
    try {
      if (PluginChecker.isRulesPluginLoaded()) {
        IRulesProviderService rulesService=(IRulesProviderService)GlobalServiceRegister.getDefault().getService(IRulesProviderService.class);
        if (rulesService != null) {
          boolean useGenerateRuleFiles=false;
          List<? extends INode> allNodes=this.process.getGeneratingNodes();
          for (int i=0; i < allNodes.size(); i++) {
            if (allNodes.get(i) instanceof INode) {
              INode node=allNodes.get(i);
              if (rulesService.isRuleComponent(node) && !node.getElementParameter(EParameterName.PROPERTY_TYPE.getName()).getValue().toString().equals("String_Node_Str")) {
                useGenerateRuleFiles=true;
                break;
              }
            }
          }
          if (useGenerateRuleFiles && rulesService != null && currentJavaProject != null) {
            rulesService.generateFinalRuleFiles(currentJavaProject,this.process);
            LastGenerationInfo.getInstance().setUseRules(this.process.getId(),this.process.getVersion(),true);
          }
        }
      }
      processCode=codeGen.generateProcessCode();
    }
 catch (    SystemException e) {
      throw new ProcessorException(Messages.getString("String_Node_Str"),e);
    }
catch (    IOException e) {
      ExceptionHandler.process(e);
    }
    final String toFormat=processCode;
    writeCodesToFile(toFormat,"String_Node_Str");
    final Job job=new Job("String_Node_Str"){
      private Thread workThread;
      @Override protected IStatus run(      IProgressMonitor monitor){
        monitor.beginTask("String_Node_Str",IProgressMonitor.UNKNOWN);
        FutureTask<Boolean> ft=new FutureTask<Boolean>(new Callable<Boolean>(){
          @Override public Boolean call() throws Exception {
            formatedCode=formatCode(toFormat);
            return Boolean.TRUE;
          }
        }
);
        Boolean isSucceed=null;
        try {
          workThread=new Thread(ft);
          workThread.start();
          isSucceed=ft.get();
        }
 catch (        Throwable e) {
          if (!monitor.isCanceled()) {
            ExceptionHandler.process(e);
          }
        }
        if (isSucceed == Boolean.TRUE && !monitor.isCanceled()) {
          writeCodesToFile(formatedCode,"String_Node_Str");
        }
        monitor.done();
        return Status.OK_STATUS;
      }
      @Override protected void canceling(){
        try {
          super.canceling();
          if (workThread != null) {
            workThread.stop();
          }
        }
 catch (        Throwable e) {
        }
      }
    }
;
    long time1=System.currentTimeMillis();
    job.setSystem(true);
    job.schedule();
    boolean f=true;
    long timeout=1000 * DesignerPlugin.getDefault().getPreferenceStore().getInt(ITalendCorePrefConstants.PERFORMANCE_JAVA_PROCESS_CODE_FORMATE_TIMEOUT);
    if (timeout <= 0) {
      timeout=30000;
    }
    while (f) {
      long time2=System.currentTimeMillis();
      if (time2 - time1 > timeout) {
        if (job.getResult() == null || !job.getResult().isOK()) {
          f=false;
          job.cancel();
          if (!CommonsPlugin.isHeadless()) {
            Display.getDefault().asyncExec(new Runnable(){
              @Override public void run(){
                MessageDialog.openWarning(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str"));
              }
            }
);
          }
        }
 else {
          processCode=formatedCode;
          f=false;
        }
      }
 else {
        if (job.getState() != Job.RUNNING) {
          if (job.getResult() != null && job.getResult().isOK()) {
            processCode=formatedCode;
            f=false;
          }
        }
      }
    }
    formatedCode=null;
    processCode=computeMethodSizeIfNeeded(processCode);
    InputStream codeStream=new ByteArrayInputStream(processCode.getBytes());
    IFile codeFile=this.getCodeProject().getFile(this.getSrcCodePath());
    if (!codeFile.exists()) {
      try {
        org.talend.commons.utils.io.FilesUtils.removeExistedResources(null,codeFile,true,true);
      }
 catch (      Exception e) {
        throw new ProcessorException(e);
      }
      IFolder parentFolder=(IFolder)codeFile.getParent();
      if (!parentFolder.exists()) {
        parentFolder.create(true,true,null);
      }
      codeFile.create(codeStream,true,null);
    }
 else {
      codeFile.setContents(codeStream,true,false,null);
    }
    processCode=null;
    codeFile.getProject().deleteMarkers("String_Node_Str",true,IResource.DEPTH_INFINITE);
    List<INode> breakpointNodes=CorePlugin.getContext().getBreakpointNodes(process);
    if (!breakpointNodes.isEmpty()) {
      String[] nodeNames=new String[breakpointNodes.size()];
      int pos=0;
      String nodeName;
      for (      INode node : breakpointNodes) {
        nodeName=node.getUniqueName();
        if (node.getComponent().getMultipleComponentManagers().size() > 0) {
          nodeName+="String_Node_Str" + node.getComponent().getMultipleComponentManagers().get(0).getInput().getName();
        }
        nodeNames[pos++]="String_Node_Str" + nodeName + "String_Node_Str";
      }
      int[] lineNumbers=getLineNumbers(codeFile,nodeNames);
      setBreakpoints(codeFile,getMainClass(),lineNumbers);
    }
  }
 catch (  CoreException e1) {
    if (e1.getStatus() != null && e1.getStatus().getException() != null) {
      ExceptionHandler.process(e1.getStatus().getException());
    }
    throw new ProcessorException(Messages.getString("String_Node_Str"),e1);
  }
}

Fixed version (ground truth):
@Override public void generateCode(boolean statistics,boolean trace,boolean javaProperties,int option) throws ProcessorException {
  super.generateCode(statistics,trace,javaProperties,option);
  try {
    String currentJavaProject=ProjectManager.getInstance().getProject(property).getTechnicalLabel();
    ICodeGenerator codeGen;
    ICodeGeneratorService service=RunProcessPlugin.getDefault().getCodeGeneratorService();
    if (javaProperties) {
      String javaInterpreter="String_Node_Str";
      String javaLib="String_Node_Str";
      String javaContext=getContextPath().toPortableString();
      codeGen=service.createCodeGenerator(process,statistics,trace,javaInterpreter,javaLib,javaContext,currentJavaProject);
    }
 else {
      codeGen=service.createCodeGenerator(process,statistics,trace);
    }
    if (!process.getContextManager().getDefaultContext().getName().equals(context.getName())) {
      boolean found=false;
      for (      IContext c : process.getContextManager().getListContext()) {
        if (c.getName().equals(context.getName())) {
          found=true;
        }
      }
      if (found) {
        codeGen.setContextName(context.getName());
      }
    }
    String processCode="String_Node_Str";
    try {
      if (PluginChecker.isRulesPluginLoaded()) {
        IRulesProviderService rulesService=(IRulesProviderService)GlobalServiceRegister.getDefault().getService(IRulesProviderService.class);
        if (rulesService != null) {
          boolean useGenerateRuleFiles=false;
          List<? extends INode> allNodes=this.process.getGeneratingNodes();
          for (int i=0; i < allNodes.size(); i++) {
            if (allNodes.get(i) instanceof INode) {
              INode node=allNodes.get(i);
              if (rulesService.isRuleComponent(node) && !node.getElementParameter(EParameterName.PROPERTY_TYPE.getName()).getValue().toString().equals("String_Node_Str")) {
                useGenerateRuleFiles=true;
                break;
              }
            }
          }
          if (useGenerateRuleFiles && rulesService != null && currentJavaProject != null) {
            rulesService.generateFinalRuleFiles(currentJavaProject,this.process);
            LastGenerationInfo.getInstance().setUseRules(this.process.getId(),this.process.getVersion(),true);
          }
        }
      }
      processCode=codeGen.generateProcessCode();
    }
 catch (    SystemException e) {
      throw new ProcessorException(Messages.getString("String_Node_Str"),e);
    }
catch (    IOException e) {
      ExceptionHandler.process(e);
    }
    if (!BitwiseOptionUtils.containOption(option,TalendProcessOptionConstants.GENERATE_WITHOUT_FORMAT)) {
      processCode=doFormat(processCode);
    }
    processCode=computeMethodSizeIfNeeded(processCode);
    InputStream codeStream=new ByteArrayInputStream(processCode.getBytes());
    IFile codeFile=this.getCodeProject().getFile(this.getSrcCodePath());
    if (!codeFile.exists()) {
      try {
        org.talend.commons.utils.io.FilesUtils.removeExistedResources(null,codeFile,true,true);
      }
 catch (      Exception e) {
        throw new ProcessorException(e);
      }
      IFolder parentFolder=(IFolder)codeFile.getParent();
      if (!parentFolder.exists()) {
        parentFolder.create(true,true,null);
      }
      codeFile.create(codeStream,true,null);
    }
 else {
      codeFile.setContents(codeStream,true,false,null);
    }
    processCode=null;
    codeFile.getProject().deleteMarkers("String_Node_Str",true,IResource.DEPTH_INFINITE);
    List<INode> breakpointNodes=CorePlugin.getContext().getBreakpointNodes(process);
    if (!breakpointNodes.isEmpty()) {
      String[] nodeNames=new String[breakpointNodes.size()];
      int pos=0;
      String nodeName;
      for (      INode node : breakpointNodes) {
        nodeName=node.getUniqueName();
        if (node.getComponent().getMultipleComponentManagers().size() > 0) {
          nodeName+="String_Node_Str" + node.getComponent().getMultipleComponentManagers().get(0).getInput().getName();
        }
        nodeNames[pos++]="String_Node_Str" + nodeName + "String_Node_Str";
      }
      int[] lineNumbers=getLineNumbers(codeFile,nodeNames);
      setBreakpoints(codeFile,getMainClass(),lineNumbers);
    }
  }
 catch (  CoreException e1) {
    if (e1.getStatus() != null && e1.getStatus().getException() != null) {
      ExceptionHandler.process(e1.getStatus().getException());
    }
    throw new ProcessorException(Messages.getString("String_Node_Str"),e1);
  }
}