Program: 125702
Project: 125702
Buggy source:
private static void generateNodeInfo(JobInfo jobInfo,String selectedContextName,boolean statistics,boolean properties,int option,IProgressMonitor progressMonitor,IProcess currentProcess) throws ProcessorException {
  if (BitwiseOptionUtils.containOption(option,GENERATE_TESTS) && jobInfo.getProcessItem() != null) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
      ITestContainerProviderService testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
      if (testContainerService != null) {
        List<ProcessItem> testsItems=testContainerService.getAllTestContainers(jobInfo.getProcessItem());
        for (        ProcessItem testItem : testsItems) {
          JobInfo subJobInfo=new JobInfo(testItem,testItem.getProcess().getDefaultContext());
          subJobInfo.setTestContainer(true);
          subJobInfo.setFatherJobInfo(jobInfo);
          if (BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
            generateCode(subJobInfo,selectedContextName,statistics,false,properties,GENERATE_MAIN_ONLY,progressMonitor);
          }
 else {
            generateCode(subJobInfo,selectedContextName,statistics,false,properties,GENERATE_ALL_CHILDS,progressMonitor);
            currentProcess.setNeedRegenerateCode(true);
          }
        }
      }
    }
  }
  jobInfo.setProcessItem(null);
  if (!BitwiseOptionUtils.containOption(option,GENERATE_MAIN_ONLY)) {
    for (    INode node : currentProcess.getGeneratingNodes()) {
      String componentName=node.getComponent().getName();
      if ((node != null) && (componentName.equals("String_Node_Str") || componentName.equals("String_Node_Str") || "String_Node_Str".equals(node.getComponent().getOriginalFamilyName()))) {
        if ("String_Node_Str".equals(componentName)) {
          if ((Boolean)node.getElementParameter("String_Node_Str").getValue()) {
            continue;
          }
        }
        boolean isNeedLoadmodules=true;
        IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
        final String jobIds=(String)processIdparam.getValue();
        for (        String jobId : jobIds.split(ProcessorUtilities.COMMA)) {
          if (StringUtils.isNotEmpty(jobId)) {
            String context=(String)node.getElementParameter("String_Node_Str").getValue();
            String version=(String)node.getElementParameter("String_Node_Str").getValue();
            final JobInfo subJobInfo=new JobInfo(jobId,context,version);
            final ProcessItem processItem=ItemCacheManager.getProcessItem(jobId,version);
            if (processItem == null) {
              throw new ProcessorException(node.getUniqueName() + "String_Node_Str" + currentProcess.getName());
            }
            subJobInfo.setJobVersion(processItem.getProperty().getVersion());
            if (!isNeedLoadmodules) {
              LastGenerationInfo.getInstance().setModulesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion(),Collections.<ModuleNeeded>emptySet());
            }
            if (jobInfo.isApplyContextToChildren()) {
              subJobInfo.setApplyContextToChildren(jobInfo.isApplyContextToChildren());
              if (checkIfContextExisted(processItem,selectedContextName)) {
                subJobInfo.setContextName(selectedContextName);
              }
 else {
                String defaultContext=processItem.getProcess().getDefaultContext();
                node.getElementParameter("String_Node_Str").setValue(defaultContext);
                subJobInfo.setContextName(defaultContext);
              }
            }
            subJobInfo.setFatherJobInfo(jobInfo);
            if (!jobList.contains(subJobInfo)) {
              int subJobOption=GENERATE_ALL_CHILDS;
              if (BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
                subJobOption=GENERATE_MAIN_ONLY;
              }
              if (BitwiseOptionUtils.containOption(option,GENERATE_TESTS)) {
                subJobOption|=GENERATE_TESTS;
              }
              generateCode(subJobInfo,selectedContextName,statistics,false,properties,isNeedLoadmodules,subJobOption,progressMonitor);
              if (!BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
                currentProcess.setNeedRegenerateCode(true);
              }
            }
            LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
            LastGenerationInfo.getInstance().getPigudfNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getPigudfNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
            LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
            if (!LastGenerationInfo.getInstance().isUseDynamic(jobInfo.getJobId(),jobInfo.getJobVersion())) {
              LastGenerationInfo.getInstance().setUseDynamic(jobInfo.getJobId(),jobInfo.getJobVersion(),LastGenerationInfo.getInstance().isUseDynamic(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
            }
            if (!LastGenerationInfo.getInstance().isUsePigUDFs(jobInfo.getJobId(),jobInfo.getJobVersion())) {
              LastGenerationInfo.getInstance().setUsePigUDFs(jobInfo.getJobId(),jobInfo.getJobVersion(),LastGenerationInfo.getInstance().isUsePigUDFs(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void generateNodeInfo(JobInfo jobInfo,String selectedContextName,boolean statistics,boolean properties,int option,IProgressMonitor progressMonitor,IProcess currentProcess) throws ProcessorException {
  if (BitwiseOptionUtils.containOption(option,GENERATE_TESTS) && jobInfo.getProcessItem() != null) {
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
      ITestContainerProviderService testContainerService=(ITestContainerProviderService)GlobalServiceRegister.getDefault().getService(ITestContainerProviderService.class);
      if (testContainerService != null) {
        List<ProcessItem> testsItems=testContainerService.getAllTestContainers(jobInfo.getProcessItem());
        for (        ProcessItem testItem : testsItems) {
          JobInfo subJobInfo=new JobInfo(testItem,testItem.getProcess().getDefaultContext());
          subJobInfo.setTestContainer(true);
          subJobInfo.setFatherJobInfo(jobInfo);
          if (BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
            generateCode(subJobInfo,selectedContextName,statistics,false,properties,GENERATE_MAIN_ONLY,progressMonitor);
          }
 else {
            generateCode(subJobInfo,selectedContextName,statistics,false,properties,GENERATE_ALL_CHILDS,progressMonitor);
            currentProcess.setNeedRegenerateCode(true);
          }
        }
      }
    }
  }
  jobInfo.setProcessItem(null);
  if (!BitwiseOptionUtils.containOption(option,GENERATE_MAIN_ONLY)) {
    for (    INode node : currentProcess.getGeneratingNodes()) {
      String componentName=node.getComponent().getName();
      if ((node != null) && (componentName.equals("String_Node_Str") || componentName.equals("String_Node_Str") || "String_Node_Str".equals(node.getComponent().getOriginalFamilyName()))) {
        if ("String_Node_Str".equals(componentName)) {
          if ((Boolean)node.getElementParameter("String_Node_Str").getValue()) {
            continue;
          }
        }
        boolean isNeedLoadmodules=true;
        IElementParameter processIdparam=node.getElementParameter("String_Node_Str");
        final String jobIds=(String)processIdparam.getValue();
        for (        String jobId : jobIds.split(ProcessorUtilities.COMMA)) {
          if (StringUtils.isNotEmpty(jobId)) {
            String context=(String)node.getElementParameter("String_Node_Str").getValue();
            String version=(String)node.getElementParameter("String_Node_Str").getValue();
            final JobInfo subJobInfo=new JobInfo(jobId,context,version);
            final ProcessItem processItem=ItemCacheManager.getProcessItem(jobId,version);
            if (processItem == null) {
              throw new ProcessorException(node.getUniqueName() + "String_Node_Str" + currentProcess.getName());
            }
            subJobInfo.setJobVersion(processItem.getProperty().getVersion());
            subJobInfo.setJobName(processItem.getProperty().getLabel());
            subJobInfo.setFatherJobInfo(jobInfo);
            if (!jobList.contains(subJobInfo)) {
              if (!isNeedLoadmodules) {
                LastGenerationInfo.getInstance().setModulesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion(),Collections.<ModuleNeeded>emptySet());
              }
              if (jobInfo.isApplyContextToChildren()) {
                subJobInfo.setApplyContextToChildren(jobInfo.isApplyContextToChildren());
                if (checkIfContextExisted(processItem,selectedContextName)) {
                  subJobInfo.setContextName(selectedContextName);
                }
 else {
                  String defaultContext=processItem.getProcess().getDefaultContext();
                  node.getElementParameter("String_Node_Str").setValue(defaultContext);
                  subJobInfo.setContextName(defaultContext);
                }
              }
              int subJobOption=GENERATE_ALL_CHILDS;
              if (BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
                subJobOption=GENERATE_MAIN_ONLY;
              }
              if (BitwiseOptionUtils.containOption(option,GENERATE_TESTS)) {
                subJobOption|=GENERATE_TESTS;
              }
              generateCode(subJobInfo,selectedContextName,statistics,false,properties,isNeedLoadmodules,subJobOption,progressMonitor);
              if (!BitwiseOptionUtils.containOption(option,GENERATE_WITH_FIRST_CHILD)) {
                currentProcess.setNeedRegenerateCode(true);
              }
              LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getModulesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
              LastGenerationInfo.getInstance().getPigudfNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getPigudfNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
              LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(jobInfo.getJobId(),jobInfo.getJobVersion()).addAll(LastGenerationInfo.getInstance().getRoutinesNeededWithSubjobPerJob(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
              if (!LastGenerationInfo.getInstance().isUseDynamic(jobInfo.getJobId(),jobInfo.getJobVersion())) {
                LastGenerationInfo.getInstance().setUseDynamic(jobInfo.getJobId(),jobInfo.getJobVersion(),LastGenerationInfo.getInstance().isUseDynamic(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
              }
              if (!LastGenerationInfo.getInstance().isUsePigUDFs(jobInfo.getJobId(),jobInfo.getJobVersion())) {
                LastGenerationInfo.getInstance().setUsePigUDFs(jobInfo.getJobId(),jobInfo.getJobVersion(),LastGenerationInfo.getInstance().isUsePigUDFs(subJobInfo.getJobId(),subJobInfo.getJobVersion()));
              }
            }
          }
        }
      }
    }
  }
}