Program: 17589
Project: 17589
Buggy source:
public static void createPopulationEPL(File path,PrgPopulation pop){
  CreateEPLPopulationDialog dialog=new CreateEPLPopulationDialog();
  if (pop != null) {
    dialog.getPopulationSize().setValue(pop.size());
    for (    VariableMapping mapping : pop.getContext().getDefinedVariables()) {
      dialog.getInputVariables().getModel().addElement(mapping.getName());
    }
  }
 else {
    dialog.getInputVariables().getModel().addElement("String_Node_Str");
    dialog.getPopulationSize().setValue(1000);
  }
  if (dialog.process()) {
    int populationSize=dialog.getPopulationSize().getValue();
    int maxDepth=dialog.getMaxDepth().getValue();
    CalculateScore score;
    if (dialog.getTrainingSet() != null) {
      score=new TrainingSetScore(dialog.getTrainingSet());
    }
 else {
      score=new ZeroEvalScoreFunction();
    }
    EncogProgramContext context=new EncogProgramContext();
    for (int i=0; i < dialog.getInputVariables().getModel().getSize(); i++) {
      String str=(String)dialog.getInputVariables().getModel().get(i);
      context.defineVariable(str);
    }
    StandardExtensions.createNumericOperators(context.getFunctions());
    if (pop == null) {
      pop=new PrgPopulation(context,populationSize);
    }
    try {
      EncogWorkBench.getInstance().getMainWindow().beginWait();
      PrgGrowGenerator generate=new PrgGrowGenerator(pop.getContext(),maxDepth);
      generate.setScore(score);
      generate.generate(new Random(),pop);
    }
  finally {
      EncogWorkBench.getInstance().getMainWindow().endWait();
    }
    if (path != null) {
      EncogWorkBench.getInstance().save(path,pop);
      EncogWorkBench.getInstance().refresh();
    }
  }
}

Fixed version (ground truth):
public static void createPopulationEPL(File path,PrgPopulation pop){
  CreateEPLPopulationDialog dialog=new CreateEPLPopulationDialog();
  if (pop != null) {
    dialog.getPopulationSize().setValue(pop.size());
    for (    VariableMapping mapping : pop.getContext().getDefinedVariables()) {
      dialog.getInputVariables().getModel().addElement(mapping.getName());
    }
  }
 else {
    dialog.getInputVariables().getModel().addElement("String_Node_Str");
    dialog.getPopulationSize().setValue(1000);
  }
  if (dialog.process()) {
    int populationSize=dialog.getPopulationSize().getValue();
    int maxDepth=dialog.getMaxDepth().getValue();
    CalculateScore score;
    if (dialog.getTrainingSet() != null) {
      score=new TrainingSetScore(dialog.getTrainingSet());
    }
 else {
      score=new ZeroEvalScoreFunction();
    }
    EncogProgramContext context=new EncogProgramContext();
    for (int i=0; i < dialog.getInputVariables().getModel().getSize(); i++) {
      String str=(String)dialog.getInputVariables().getModel().get(i);
      context.defineVariable(str);
    }
    StandardExtensions.createNumericOperators(context);
    if (pop == null) {
      pop=new PrgPopulation(context,populationSize);
    }
    try {
      EncogWorkBench.getInstance().getMainWindow().beginWait();
      PrgGrowGenerator generate=new PrgGrowGenerator(pop.getContext(),maxDepth);
      generate.setScore(score);
      generate.generate(new Random(),pop);
    }
  finally {
      EncogWorkBench.getInstance().getMainWindow().endWait();
    }
    if (path != null) {
      EncogWorkBench.getInstance().save(path,pop);
      EncogWorkBench.getInstance().refresh();
    }
  }
}