nus-yam/ex-repair huggingface dataset:
Program: 64572
Project: 64572
Buggy source:
protected void updatePosition(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updatePosition(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void updatePosition(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updatePosition(swarmList.get(i));
  }
}
Program: 64573
Project: 64573
Buggy source:
protected void updateParticlesMemory(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updateParticlesMemory(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void updateParticlesMemory(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updateParticlesMemory(swarmList.get(i));
  }
}
Program: 64574
Project: 64574
Buggy source:
protected void perturbation(List<List<DoubleSolution>> swarm){
}

Fixed version (ground truth):
protected void perturbation(List<List<DoubleSolution>> swarmList){
}
Program: 64575
Project: 64575
Buggy source:
protected void initializeVelocity(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeVelocity(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void initializeVelocity(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeVelocity(swarmList.get(i));
  }
}
Program: 64576
Project: 64576
Buggy source:
protected void updateVelocity(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updateVelocity(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void updateVelocity(List<List<DoubleSolution>> swarmList){
  updateSwarmVelocity(swarmList);
}
Program: 64577
Project: 64577
Buggy source:
protected void updateLeaders(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updateLeaders(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void updateLeaders(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).updateLeaders(swarmList.get(i));
  }
}
Program: 64578
Project: 64578
Buggy source:
public Vepso(DoubleProblem problem,int swarmSize,int maxIterations,int numberOfParticlesToInform,Archive<DoubleSolution> archive){
  this.problem=problem;
  this.swarmSize=swarmSize;
  this.maxIterations=maxIterations;
  this.numberOfParticlesToInform=numberOfParticlesToInform;
  this.archive=archive;
  psoIsland=new ArrayList<StandardPSO2007>();
  for (int i=0; i < problem.getNumberOfObjectives(); i++) {
    psoIsland.add(new StandardPSO2007(problem,i,swarmSize,maxIterations,numberOfParticlesToInform,new SequentialSolutionListEvaluator<DoubleSolution>()));
  }
}

Fixed version (ground truth):
public Vepso(DoubleProblem problem,int swarmSize,int maxIterations,int numberOfParticlesToInform,Archive<DoubleSolution> archive){
  this.problem=problem;
  this.swarmSize=swarmSize;
  this.maxIterations=maxIterations;
  this.numberOfParticlesToInform=numberOfParticlesToInform;
  this.archive=archive;
  weight=1.0 / (2.0 * Math.log(2));
  c=1.0 / 2.0 + Math.log(2);
  speed=new GenericSolutionAttribute<DoubleSolution,double[]>();
  localBest=new LocalBestAttribute();
  neighborhoodBest=new NeighborhoodBestAttribute();
  psoIsland=new ArrayList<StandardPSO2007>();
  for (int i=0; i < problem.getNumberOfObjectives(); i++) {
    psoIsland.add(new StandardPSO2007(problem,i,swarmSize,maxIterations / problem.getNumberOfObjectives(),numberOfParticlesToInform,new SequentialSolutionListEvaluator<DoubleSolution>()));
  }
}
Program: 64579
Project: 64579
Buggy source:
protected void initializeLeaders(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeLeaders(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void initializeLeaders(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeLeaders(swarmList.get(i));
  }
}
Program: 64580
Project: 64580
Buggy source:
protected List<List<DoubleSolution>> evaluateSwarm(List<List<DoubleSolution>> swarm){
  List<List<DoubleSolution>> swarms=new ArrayList<>(problem.getNumberOfObjectives());
  for (int i=0; i < psoIsland.size(); i++) {
    swarms.add(i,psoIsland.get(i).evaluateSwarm(swarm.get(i)));
    updateArchive(swarm.get(i));
  }
  return swarms;
}

Fixed version (ground truth):
protected List<List<DoubleSolution>> evaluateSwarm(List<List<DoubleSolution>> swarmList){
  List<List<DoubleSolution>> swarms=new ArrayList<>(problem.getNumberOfObjectives());
  for (int i=0; i < psoIsland.size(); i++) {
    swarms.add(i,psoIsland.get(i).evaluateSwarm(swarmList.get(i)));
    updateArchive(swarmList.get(i));
  }
  return swarms;
}
Program: 64581
Project: 64581
Buggy source:
protected void initializeParticlesMemory(List<List<DoubleSolution>> swarm){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeParticlesMemory(swarm.get(i));
    psoIsland.get(i).setSwarm(swarm.get(i));
  }
}

Fixed version (ground truth):
protected void initializeParticlesMemory(List<List<DoubleSolution>> swarmList){
  for (int i=0; i < psoIsland.size(); i++) {
    psoIsland.get(i).initializeParticlesMemory(swarmList.get(i));
    psoIsland.get(i).setSwarm(swarmList.get(i));
  }
}
Program: 64582
Project: 64582
Buggy source:
/** 
 * Constructor
 * @param solutionListSize The expected size of the list of solutions
 * @param numberOfRandomNeighbours The number of neighbors per solution
 */
public AdaptiveRandomNeighborhood(int solutionListSize,int numberOfRandomNeighbours){
  if (numberOfRandomNeighbours < 0) {
    throw new JMetalException("String_Node_Str" + numberOfRandomNeighbours);
  }
 else   if (solutionListSize <= numberOfRandomNeighbours) {
    throw new JMetalException("String_Node_Str" + solutionListSize + "String_Node_Str"+ "String_Node_Str"+ numberOfRandomNeighbours);
  }
  this.solutionListSize=solutionListSize;
  this.numberOfRandomNeighbours=numberOfRandomNeighbours;
  createNeighborhoods();
  addRandomNeighbors();
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param solutionListSize The expected size of the list of solutions
 * @param numberOfRandomNeighbours The number of neighbors per solution
 */
public AdaptiveRandomNeighborhood(int solutionListSize,int numberOfRandomNeighbours){
  if (numberOfRandomNeighbours < 0) {
    throw new JMetalException("String_Node_Str" + numberOfRandomNeighbours);
  }
 else   if (solutionListSize <= numberOfRandomNeighbours) {
    throw new JMetalException("String_Node_Str" + solutionListSize + "String_Node_Str"+ "String_Node_Str"+ numberOfRandomNeighbours);
  }
  this.solutionListSize=solutionListSize;
  this.numberOfRandomNeighbours=numberOfRandomNeighbours;
  this.randomGenerator=JMetalRandom.getInstance();
  createNeighborhoods();
  addRandomNeighbors();
}
Program: 64583
Project: 64583
Buggy source:
/** 
 * Case 1 Solution list size: 4 Number of neighbors: 3
 */
@Test public void shouldGetNeighborsReturnThreeNeighborsPlusTheCurrentSolution(){
  int solutionListSize=3;
  int numberOfNeighbors=1;
  AdaptiveRandomNeighborhood<IntegerSolution> neighborhood=new AdaptiveRandomNeighborhood<IntegerSolution>(solutionListSize,numberOfNeighbors);
  JMetalRandom randomGenerator=mock(JMetalRandom.class);
  when(randomGenerator.nextInt(0,solutionListSize - 1)).thenReturn(2,0,1);
  ReflectionTestUtils.setField(neighborhood,"String_Node_Str",randomGenerator);
  List<IntegerSolution> list=new ArrayList<>(solutionListSize);
  for (int i=0; i < solutionListSize; i++) {
    list.add(mock(IntegerSolution.class));
  }
  List<IntegerSolution> result=neighborhood.getNeighbors(list,0);
  assertEquals(numberOfNeighbors + 1,result.size());
  assertEquals(list.get(0),result.get(0));
  ;
  assertEquals(list.get(2),result.get(1));
  ;
}

Fixed version (ground truth):
/** 
 * Case 1 Solution list size: 3 Number of neighbors: 1 Neighbors: - solution 0: 0, 2 - solution 1: 1, 0 - solution 2: 2, 0
 */
@Test public void shouldGetNeighborsReturnThreeNeighborsPlusTheCurrentSolution(){
  int solutionListSize=3;
  int numberOfNeighbors=1;
  AdaptiveRandomNeighborhood<IntegerSolution> neighborhood=new AdaptiveRandomNeighborhood<IntegerSolution>(solutionListSize,numberOfNeighbors);
  JMetalRandom randomGenerator=mock(JMetalRandom.class);
  when(randomGenerator.nextInt(0,solutionListSize - 1)).thenReturn(2,0,0);
  ReflectionTestUtils.setField(neighborhood,"String_Node_Str",randomGenerator);
  List<IntegerSolution> list=new ArrayList<>(solutionListSize);
  for (int i=0; i < solutionListSize; i++) {
    list.add(mock(IntegerSolution.class));
  }
  neighborhood.recompute();
  List<IntegerSolution> result;
  result=neighborhood.getNeighbors(list,0);
  assertEquals(numberOfNeighbors + 1,result.size());
  assertEquals(list.get(0),result.get(0));
  assertEquals(list.get(2),result.get(1));
  result=neighborhood.getNeighbors(list,1);
  assertEquals(numberOfNeighbors + 1,result.size());
  assertEquals(list.get(1),result.get(0));
  assertEquals(list.get(0),result.get(1));
  result=neighborhood.getNeighbors(list,2);
  assertEquals(numberOfNeighbors + 1,result.size());
  assertEquals(list.get(2),result.get(0));
  assertEquals(list.get(0),result.get(1));
}
Program: 64584
Project: 64584
Buggy source:
/** 
 * Calculate distance of the reference point to the point of the front point according to Pareto dominance
 * @param point
 * @param referencePoint
 * @return
 */
private double calculateDistance(Point point,Point referencePoint){
  double result=0.0;
  for (int i=0; i < point.getNumberOfDimensions(); i++) {
    double value=referencePoint.getDimensionValue(i) - point.getDimensionValue(i);
    if (value > 0.0) {
      result+=value;
    }
  }
  return Math.sqrt(result);
}

Fixed version (ground truth):
/** 
 * Calculate distance of the reference point to the point of the front point according to Pareto dominance
 * @param point
 * @param referencePoint
 * @return
 */
private double calculateDistance(Point point,Point referencePoint){
  double result=0.0;
  for (int i=0; i < point.getNumberOfDimensions(); i++) {
    double value=referencePoint.getDimensionValue(i) - point.getDimensionValue(i);
    if (value > 0.0) {
      result+=Math.pow(value,2.0);
    }
  }
  return Math.sqrt(result);
}
Program: 64585
Project: 64585
Buggy source:
@Override public ABYSS build(){
  return new ABYSS(problem,populationSize,refSet1Size,refSet2Size,archiveSize,maxEvaluations,archive,improvementOperator,crossoverOperator,numberOfSubranges);
}

Fixed version (ground truth):
@Override public ABYSS build(){
  return new ABYSS(problem,maxEvaluations,populationSize,refSet1Size,refSet2Size,archiveSize,archive,improvementOperator,crossoverOperator,numberOfSubranges);
}
Program: 64586
Project: 64586
Buggy source:
@Override public void restart(){
  getPopulation().clear();
  addReferenceSet1ToPopulation();
  updatePopulationWithArchive();
  fillPopulationWithRandomSolutions();
}

Fixed version (ground truth):
@Override public void restart(){
  System.out.println("String_Node_Str");
  getPopulation().clear();
  addReferenceSet1ToPopulation();
  updatePopulationWithArchive();
  fillPopulationWithRandomSolutions();
}
Program: 64587
Project: 64587
Buggy source:
/** 
 * @return
 */
@Override public List<List<DoubleSolution>> subsetGeneration(){
  List<List<DoubleSolution>> solutionGroupsList;
  solutionGroupsList=generatePairsFromSolutionList(referenceSet1);
  solutionGroupsList.addAll(generatePairsFromSolutionList(referenceSet2));
  for (  List<DoubleSolution> pair : solutionGroupsList) {
    marked.setAttribute(pair.get(0),true);
    marked.setAttribute(pair.get(1),true);
  }
  return solutionGroupsList;
}

Fixed version (ground truth):
/** 
 * @return
 */
@Override public List<List<DoubleSolution>> subsetGeneration(){
  List<List<DoubleSolution>> solutionGroupsList;
  solutionGroupsList=generatePairsFromSolutionList(referenceSet1);
  System.out.println("String_Node_Str" + solutionGroupsList.size());
  solutionGroupsList.addAll(generatePairsFromSolutionList(referenceSet2));
  System.out.println("String_Node_Str" + solutionGroupsList.size());
  for (  List<DoubleSolution> pair : solutionGroupsList) {
  }
  return solutionGroupsList;
}
Program: 64588
Project: 64588
Buggy source:
/** 
 * Generate all pair combinations of the referenceSet1
 */
public List<List<DoubleSolution>> generatePairsFromSolutionList(List<DoubleSolution> solutionList){
  List<List<DoubleSolution>> subset=new ArrayList<>();
  for (int i=0; i < solutionList.size(); i++) {
    DoubleSolution solution1=solutionList.get(i);
    for (int j=i + 1; j < solutionList.size(); j++) {
      DoubleSolution solution2=solutionList.get(j);
      List<DoubleSolution> pair=new ArrayList<>(2);
      pair.add(solution1);
      pair.add(solution2);
      subset.add(pair);
    }
  }
  return subset;
}

Fixed version (ground truth):
/** 
 * Generate all pair combinations of the referenceSet1
 */
public List<List<DoubleSolution>> generatePairsFromSolutionList(List<DoubleSolution> solutionList){
  List<List<DoubleSolution>> subset=new ArrayList<>();
  for (int i=0; i < solutionList.size(); i++) {
    DoubleSolution solution1=solutionList.get(i);
    for (int j=i + 1; j < solutionList.size(); j++) {
      DoubleSolution solution2=solutionList.get(j);
      if (!marked.getAttribute(solution1) || !marked.getAttribute(solution2)) {
        List<DoubleSolution> pair=new ArrayList<>(2);
        pair.add(solution1);
        pair.add(solution2);
        subset.add(pair);
        marked.setAttribute(solutionList.get(i),true);
        marked.setAttribute(solutionList.get(j),true);
      }
    }
  }
  return subset;
}
Program: 64589
Project: 64589
Buggy source:
@Override public boolean restartConditionIsFulfilled(){
  boolean allTheSolutionsAreMarked=true;
  int i=0;
  while ((i < referenceSet1.size()) && allTheSolutionsAreMarked) {
    if (marked.getAttribute(referenceSet1.get(i))) {
      i++;
    }
 else {
      allTheSolutionsAreMarked=false;
    }
  }
  i=0;
  while ((i < referenceSet2.size()) && allTheSolutionsAreMarked) {
    if (marked.getAttribute(referenceSet2.get(i))) {
      i++;
    }
 else {
      allTheSolutionsAreMarked=false;
    }
  }
  return allTheSolutionsAreMarked;
}

Fixed version (ground truth):
@Override public boolean restartConditionIsFulfilled(List<DoubleSolution> combinedSolutions){
  if (combinedSolutions.isEmpty()) {
    return true;
  }
 else {
    return false;
  }
}
Program: 64590
Project: 64590
Buggy source:
@Override public List<DoubleSolution> solutionCombination(List<List<DoubleSolution>> solutionList){
  List<DoubleSolution> resultList=new ArrayList<>();
  for (  List<DoubleSolution> pair : solutionList) {
    List<DoubleSolution> offspring=(List<DoubleSolution>)crossover.execute(pair);
    if (problem instanceof ConstrainedProblem) {
      ((ConstrainedProblem)problem).evaluateConstraints(offspring.get(0));
      ((ConstrainedProblem)problem).evaluateConstraints(offspring.get(1));
    }
    problem.evaluate(offspring.get(0));
    problem.evaluate(offspring.get(1));
    evaluations+=2;
    resultList.add(offspring.get(0));
    resultList.add(offspring.get(1));
  }
  return resultList;
}

Fixed version (ground truth):
@Override public List<DoubleSolution> solutionCombination(List<List<DoubleSolution>> solutionList){
  List<DoubleSolution> resultList=new ArrayList<>();
  for (  List<DoubleSolution> pair : solutionList) {
    List<DoubleSolution> offspring=(List<DoubleSolution>)crossover.execute(pair);
    if (problem instanceof ConstrainedProblem) {
      ((ConstrainedProblem)problem).evaluateConstraints(offspring.get(0));
      ((ConstrainedProblem)problem).evaluateConstraints(offspring.get(1));
    }
    problem.evaluate(offspring.get(0));
    problem.evaluate(offspring.get(1));
    evaluations+=2;
    resultList.add(offspring.get(0));
    resultList.add(offspring.get(1));
  }
  System.out.println("String_Node_Str" + resultList.size());
  return resultList;
}
Program: 64591
Project: 64591
Buggy source:
@Override public void referenceSetUpdate(DoubleSolution solution){
  if (refSet1Test(solution)) {
    for (int indSet2=0; indSet2 < referenceSet2.size(); indSet2++) {
      double aux=SolutionUtils.distanceBetweenSolutions(solution,referenceSet2.get(indSet2));
      DoubleSolution auxSolution=referenceSet2.get(indSet2);
      if (aux < distanceToSolutionListAttribute.getAttribute(auxSolution)) {
        distanceToSolutionListAttribute.setAttribute(auxSolution,aux);
      }
    }
  }
 else {
    refSet2Test(solution);
  }
}

Fixed version (ground truth):
/** 
 * Update the reference set with a new solution
 * @param solution
 */
@Override public void referenceSetUpdate(DoubleSolution solution){
  if (refSet1Test(solution)) {
    for (int indSet2=0; indSet2 < referenceSet2.size(); indSet2++) {
      double aux=SolutionUtils.distanceBetweenSolutions(solution,referenceSet2.get(indSet2));
      DoubleSolution auxSolution=referenceSet2.get(indSet2);
      if (aux < distanceToSolutionListAttribute.getAttribute(auxSolution)) {
        distanceToSolutionListAttribute.setAttribute(auxSolution,aux);
      }
    }
  }
 else {
    refSet2Test(solution);
  }
}
Program: 64594
Project: 64594
Buggy source:
@Override public void run(){
  initializationPhase();
  referenceSetUpdate();
  while (!isStoppingConditionReached()) {
    if (restartConditionIsFulfilled()) {
      restart();
    }
 else {
      List<List<S>> subset=subsetGeneration();
      List<S> combinedSolutions=solutionCombination(subset);
      for (      S solution : combinedSolutions) {
        S improvedSolution=improvement(solution);
        referenceSetUpdate(improvedSolution);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  initializationPhase();
  referenceSetUpdate();
  while (!isStoppingConditionReached()) {
    List<List<S>> subset=subsetGeneration();
    List<S> combinedSolutions=solutionCombination(subset);
    for (    S solution : combinedSolutions) {
      S improvedSolution=improvement(solution);
      referenceSetUpdate(improvedSolution);
    }
    if (restartConditionIsFulfilled(combinedSolutions)) {
      restart();
      referenceSetUpdate();
    }
  }
}
Program: 64595
Project: 64595
Buggy source:
public abstract boolean restartConditionIsFulfilled();

Fixed version (ground truth):
public abstract boolean restartConditionIsFulfilled(List<S> solutionList);
Program: 64598
Project: 64598
Buggy source:
@Test public void shouldDefaultConstructorSetTheNumberOfSolutionsToBeReturnedEqualsToTwo(){
  selection=new NaryTournamentSelection<Solution<?>>();
  assertEquals(2,ReflectionTestUtils.getField(selection,"String_Node_Str"));
}

Fixed version (ground truth):
@Test public void shouldDefaultConstructorSetTheNumberOfSolutionsToBeReturnedEqualsToTwo(){
  NaryTournamentSelection<IntegerSolution> selection=new NaryTournamentSelection<>();
  assertEquals(2,ReflectionTestUtils.getField(selection,"String_Node_Str"));
}
Program: 64599
Project: 64599
Buggy source:
@Test public void shouldExecuteReturnAValidSolutionIsWithCorrectParameters(){
  selection=new NaryTournamentSelection<Solution<?>>();
  Solution<Object> solution=mock(Solution.class);
  Problem<Solution<Object>> problem=mock(Problem.class);
  Mockito.when(problem.createSolution()).thenReturn(solution);
  population=new ArrayList<>(POPULATION_SIZE);
  for (int i=0; i < POPULATION_SIZE; i++) {
    population.add(problem.createSolution());
  }
  assertNotNull(selection.execute(population));
  verify(problem,times(POPULATION_SIZE)).createSolution();
}

Fixed version (ground truth):
@Test public void shouldExecuteReturnAValidSolutionIsWithCorrectParameters(){
  NaryTournamentSelection<BinarySolution> selection=new NaryTournamentSelection<>();
  BinarySolution solution=mock(BinarySolution.class);
  Problem<BinarySolution> problem=mock(Problem.class);
  Mockito.when(problem.createSolution()).thenReturn(solution);
  List<BinarySolution> population=new ArrayList<>(POPULATION_SIZE);
  for (int i=0; i < POPULATION_SIZE; i++) {
    population.add(problem.createSolution());
  }
  assertNotNull(selection.execute(population));
  verify(problem,times(POPULATION_SIZE)).createSolution();
}
Program: 64600
Project: 64600
Buggy source:
@Test public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsNull(){
  exception.expect(JMetalException.class);
  exception.expectMessage(containsString("String_Node_Str"));
  selection=new NaryTournamentSelection<Solution<?>>();
  population=null;
  selection.execute(population);
}

Fixed version (ground truth):
@Test public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsNull(){
  exception.expect(JMetalException.class);
  exception.expectMessage(containsString("String_Node_Str"));
  NaryTournamentSelection<IntegerSolution> selection=new NaryTournamentSelection<>();
  List<IntegerSolution> population;
  population=null;
  selection.execute(population);
}
Program: 64601
Project: 64601
Buggy source:
@Test public void shouldExecuteRaiseAnExceptionIfTheListSizeIsOneAndTwoSolutionsAreRequested(){
  exception.expect(JMetalException.class);
  exception.expectMessage(containsString("String_Node_Str" + "String_Node_Str"));
  selection=new NaryTournamentSelection<Solution<?>>(4,mock(Comparator.class));
  List<Solution<?>> list=new ArrayList<>(1);
  list.add(mock(Solution.class));
  selection.execute(list);
}

Fixed version (ground truth):
@Test public void shouldExecuteRaiseAnExceptionIfTheListSizeIsOneAndTwoSolutionsAreRequested(){
  exception.expect(JMetalException.class);
  exception.expectMessage(containsString("String_Node_Str" + "String_Node_Str"));
  NaryTournamentSelection<IntegerSolution> selection=new NaryTournamentSelection<>(4,mock(Comparator.class));
  List<IntegerSolution> list=new ArrayList<>(1);
  list.add(mock(IntegerSolution.class));
  selection.execute(list);
}
Program: 64602
Project: 64602
Buggy source:
@Test public void shouldExecuteReturnTwoSolutionsIfTheListContainsTwoSolutions(){
  selection=new NaryTournamentSelection<Solution<?>>(2,mock(Comparator.class));
  Solution<?> solution1=mock(Solution.class);
  Solution<?> solution2=mock(Solution.class);
  population=Arrays.asList(solution1,solution2);
  assertEquals(2,population.size());
}

Fixed version (ground truth):
@Test public void shouldExecuteReturnTwoSolutionsIfTheListContainsTwoSolutions(){
  NaryTournamentSelection<IntegerSolution> selection=new NaryTournamentSelection<>(2,mock(Comparator.class));
  IntegerSolution solution1=mock(IntegerSolution.class);
  IntegerSolution solution2=mock(IntegerSolution.class);
  List<IntegerSolution> population=Arrays.asList(solution1,solution2);
  assertEquals(2,population.size());
}
Program: 64603
Project: 64603
Buggy source:
@Test public void shouldExecuteReturnTheSameSolutionIfTheListContainsOneSolution(){
  selection=new NaryTournamentSelection<Solution<?>>(1,mock(Comparator.class));
  Solution<?> solution=mock(Solution.class);
  population=new ArrayList<>(1);
  population.add(solution);
  assertSame(solution,selection.execute(population));
}

Fixed version (ground truth):
@Test public void shouldExecuteReturnTheSameSolutionIfTheListContainsOneSolution(){
  NaryTournamentSelection<DoubleSolution> selection=new NaryTournamentSelection<DoubleSolution>(1,mock(Comparator.class));
  DoubleSolution solution=mock(DoubleSolution.class);
  List<DoubleSolution> population=new ArrayList<>(1);
  population.add(solution);
  assertSame(solution,selection.execute(population));
}
Program: 64604
Project: 64604
Buggy source:
@Test(expected=JMetalException.class) public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsEmpty(){
  selection=new NaryTournamentSelection<Solution<?>>();
  population=new ArrayList<>(0);
  selection.execute(population);
}

Fixed version (ground truth):
@Test(expected=JMetalException.class) public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsEmpty(){
  NaryTournamentSelection<IntegerSolution> selection=new NaryTournamentSelection<>();
  List<IntegerSolution> population=new ArrayList<>(0);
  selection.execute(population);
}
Program: 64605
Project: 64605
Buggy source:
/** 
 * Execute() method 
 */
@Override public Result execute(Source source){
  if (null == source) {
    throw new JMetalException("String_Node_Str");
  }
 else   if (source.size() != 2) {
    throw new JMetalException("String_Node_Str" + source.size());
  }
  return (Result)source;
}

Fixed version (ground truth):
/** 
 * Execute() method 
 */
@Override public Result execute(Source source){
  if (null == source) {
    throw new JMetalException("String_Node_Str");
  }
 else   if (source.size() != 2) {
    throw new JMetalException("String_Node_Str" + source.size());
  }
  List<Solution> list=new ArrayList<>();
  list.add(source.get(0).copy());
  list.add(source.get(1).copy());
  return (Result)list;
}
Program: 64606
Project: 64606
Buggy source:
@Test(expected=JMetalException.class) public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsNull(){
  selection=new NaryTournamentSelection();
  population=null;
  selection.execute(population);
}

Fixed version (ground truth):
@Test public void shouldExecuteRaiseAnExceptionIfTheListOfSolutionsIsNull(){
  exception.expect(JMetalException.class);
  exception.expectMessage(containsString("String_Node_Str"));
  selection=new NaryTournamentSelection();
  population=null;
  selection.execute(population);
}
Program: 64607
Project: 64607
Buggy source:
@Override public Object getAttributeID(){
  return this;
}

Fixed version (ground truth):
@Override public Object getAttributeID(){
  return this.getClass().getName();
}
Program: 64609
Project: 64609
Buggy source:
private void doRealMutation(double probability,IntegerSolution solution){
  Double rnd, delta1, delta2, mutPow, deltaq;
  Double y, yl, yu, val, xy;
  for (int i=0; i < solution.getNumberOfVariables(); i++) {
    if (randomGenerator.nextDouble() <= probability) {
      y=(double)solution.getVariableValue(i);
      yl=(double)solution.getLowerBound(i);
      yu=(double)solution.getUpperBound(i);
      delta1=(y - yl) / (yu - yl);
      delta2=(yu - y) / (yu - yl);
      rnd=randomGenerator.nextDouble();
      mutPow=1.0 / (distributionIndex + 1.0);
      if (rnd <= 0.5) {
        xy=1.0 - delta1;
        val=2.0 * rnd + (1.0 - 2.0 * rnd) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=Math.pow(val,mutPow) - 1.0;
      }
 else {
        xy=1.0 - delta2;
        val=2.0 * (1.0 - rnd) + 2.0 * (rnd - 0.5) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=1.0 - Math.pow(val,mutPow);
      }
      y=y + deltaq * (yu - yl);
      if (y < yl) {
        y=yl;
      }
      if (y > yu) {
        y=yu;
      }
      solution.setVariableValue(i,y.intValue());
    }
  }
}

Fixed version (ground truth):
private void doRealMutation(double probability,IntegerSolution solution){
  Double rnd, delta1, delta2, mutPow, deltaq;
  Double y, yl, yu, val, xy;
  for (int i=0; i < solution.getNumberOfVariables(); i++) {
    if (randomGenerator.nextDouble() <= probability) {
      y=(double)solution.getVariableValue(i);
      yl=(double)solution.getLowerBound(i);
      yu=(double)solution.getUpperBound(i);
      if (yl == yu) {
        throw new JMetalException("String_Node_Str" + yl);
      }
      delta1=(y - yl) / (yu - yl);
      delta2=(yu - y) / (yu - yl);
      rnd=randomGenerator.nextDouble();
      mutPow=1.0 / (distributionIndex + 1.0);
      if (rnd <= 0.5) {
        xy=1.0 - delta1;
        val=2.0 * rnd + (1.0 - 2.0 * rnd) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=Math.pow(val,mutPow) - 1.0;
      }
 else {
        xy=1.0 - delta2;
        val=2.0 * (1.0 - rnd) + 2.0 * (rnd - 0.5) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=1.0 - Math.pow(val,mutPow);
      }
      y=y + deltaq * (yu - yl);
      if (y < yl) {
        y=yl;
      }
      if (y > yu) {
        y=yu;
      }
      solution.setVariableValue(i,y.intValue());
    }
  }
}
Program: 64610
Project: 64610
Buggy source:
/** 
 * Perform the mutation operation 
 */
private void doMutation(double probability,DoubleSolution solution){
  double rnd, delta1, delta2, mutPow, deltaq;
  double y, yl, yu, val, xy;
  for (int i=0; i < solution.getNumberOfVariables(); i++) {
    if (randomGenerator.nextDouble() <= probability) {
      y=solution.getVariableValue(i);
      yl=solution.getLowerBound(i);
      yu=solution.getUpperBound(i);
      delta1=(y - yl) / (yu - yl);
      delta2=(yu - y) / (yu - yl);
      rnd=randomGenerator.nextDouble();
      mutPow=1.0 / (distributionIndex + 1.0);
      if (rnd <= 0.5) {
        xy=1.0 - delta1;
        val=2.0 * rnd + (1.0 - 2.0 * rnd) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=Math.pow(val,mutPow) - 1.0;
      }
 else {
        xy=1.0 - delta2;
        val=2.0 * (1.0 - rnd) + 2.0 * (rnd - 0.5) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=1.0 - Math.pow(val,mutPow);
      }
      y=y + deltaq * (yu - yl);
      y=solutionRepair.repairSolutionVariableValue(y,yl,yu);
      solution.setVariableValue(i,y);
    }
  }
}

Fixed version (ground truth):
/** 
 * Perform the mutation operation 
 */
private void doMutation(double probability,DoubleSolution solution){
  double rnd, delta1, delta2, mutPow, deltaq;
  double y, yl, yu, val, xy;
  for (int i=0; i < solution.getNumberOfVariables(); i++) {
    if (randomGenerator.nextDouble() <= probability) {
      y=solution.getVariableValue(i);
      yl=solution.getLowerBound(i);
      yu=solution.getUpperBound(i);
      if (yl == yu) {
        throw new JMetalException("String_Node_Str" + yl);
      }
      delta1=(y - yl) / (yu - yl);
      delta2=(yu - y) / (yu - yl);
      rnd=randomGenerator.nextDouble();
      mutPow=1.0 / (distributionIndex + 1.0);
      if (rnd <= 0.5) {
        xy=1.0 - delta1;
        val=2.0 * rnd + (1.0 - 2.0 * rnd) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=Math.pow(val,mutPow) - 1.0;
      }
 else {
        xy=1.0 - delta2;
        val=2.0 * (1.0 - rnd) + 2.0 * (rnd - 0.5) * (Math.pow(xy,distributionIndex + 1.0));
        deltaq=1.0 - Math.pow(val,mutPow);
      }
      y=y + deltaq * (yu - yl);
      y=solutionRepair.repairSolutionVariableValue(y,yl,yu);
      solution.setVariableValue(i,y);
    }
  }
}
Program: 64611
Project: 64611
Buggy source:
@Test public void shouldExecuteReturnTheSecondSelectedSolutionIsIsDominatedByTheFirstOne(){
  Comparator<Solution> comparator=mock(Comparator.class);
  Solution solution1=mock(Solution.class);
  Mockito.when(solution1.getNumberOfObjectives()).thenReturn(2);
  Mockito.when(solution1.getObjective(0)).thenReturn(1.0);
  Mockito.when(solution1.getObjective(1)).thenReturn(2.0);
  Solution solution2=mock(Solution.class);
  Mockito.when(solution2.getNumberOfObjectives()).thenReturn(1);
  Mockito.when(solution2.getObjective(0)).thenReturn(2.0);
  Mockito.when(solution2.getObjective(1)).thenReturn(3.0);
  Mockito.when(comparator.compare(solution1,solution2)).thenReturn(-1);
  Mockito.when(comparator.compare(solution2,solution1)).thenReturn(1);
  List<Solution> population=Arrays.asList(solution1,solution2);
  selection=new BinaryTournamentSelection(comparator);
  Solution result=selection.execute(population);
  assertEquals(solution1,result);
  assertNotEquals(solution2,result);
  verify(comparator).compare(any(Solution.class),any(Solution.class));
}

Fixed version (ground truth):
@Test public void shouldExecuteReturnTheSecondSelectedSolutionIsIsDominatedByTheFirstOne(){
  Comparator<Solution> comparator=mock(Comparator.class);
  Solution solution1=mock(Solution.class);
  Mockito.when(solution1.getNumberOfObjectives()).thenReturn(2);
  Mockito.when(solution1.getObjective(0)).thenReturn(1.0);
  Mockito.when(solution1.getObjective(1)).thenReturn(2.0);
  Solution solution2=mock(Solution.class);
  Mockito.when(solution2.getNumberOfObjectives()).thenReturn(2);
  Mockito.when(solution2.getObjective(0)).thenReturn(2.0);
  Mockito.when(solution2.getObjective(1)).thenReturn(3.0);
  Mockito.when(comparator.compare(solution1,solution2)).thenReturn(-1);
  Mockito.when(comparator.compare(solution2,solution1)).thenReturn(1);
  List<Solution> population=Arrays.asList(solution1,solution2);
  selection=new BinaryTournamentSelection(comparator);
  Solution result=selection.execute(population);
  assertEquals(solution1,result);
  assertNotEquals(solution2,result);
  verify(comparator).compare(any(Solution.class),any(Solution.class));
}
Program: 64613
Project: 64613
Buggy source:
private void initialListSolution(){
  try {
    DoubleSolution solution;
    for (int i=0; i < this.solutionSetSize; i++) {
      solution=super.diversificationGeneration();
      problem.evaluate(solution);
      if (problem instanceof ConstrainedProblem) {
        ((ConstrainedProblem)problem).evaluateConstraints(solution);
      }
      evaluations++;
      solution=(DoubleSolution)improvementOperator.execute(solution);
      marked.setAttribute(solution,false);
      if (strenghtRawFitness.getAttribute(solution) == null) {
        strenghtRawFitness.setAttribute(solution,0.0);
      }
      evaluations+=improvementOperator.getEvaluations();
      solutionSet.add(solution);
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
private void initialListSolution(){
  try {
    DoubleSolution solution;
    for (int i=0; i < this.solutionSetSize; i++) {
      solution=super.diversificationGeneration();
      problem.evaluate(solution);
      if (problem instanceof ConstrainedProblem) {
        ((ConstrainedProblem)problem).evaluateConstraints(solution);
      }
      evaluations++;
      solution=(DoubleSolution)improvementOperator.execute(solution);
      marked.setAttribute(solution,false);
      evaluations+=improvementOperator.getEvaluations();
      solutionSet.add(solution);
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 64615
Project: 64615
Buggy source:
/** 
 * Returns a <code>Solution</code> using the diversification generation method described in the scatter search template.
 * @throws javax.management.JMException
 * @throws ClassNotFoundException
 */
public DoubleSolution diversificationGeneration() throws JMException, ClassNotFoundException {
  DoubleSolution solution=problem.createSolution();
  marked.setAttribute(solution,false);
  strenghtRawFitness.setAttribute(solution,0.0);
  double value;
  int range;
  for (int i=0; i < problem.getNumberOfVariables(); i++) {
    sumOfReverseFrequencyValues[i]=0;
    for (int j=0; j < numberOfSubranges; j++) {
      reverseFrequency[j][i]=sumOfFrequencyValues[i] - frequency[j][i];
      sumOfReverseFrequencyValues[i]+=reverseFrequency[j][i];
    }
    if (sumOfReverseFrequencyValues[i] == 0) {
      range=randomGenerator.nextInt(0,numberOfSubranges - 1);
    }
 else {
      value=randomGenerator.nextInt(0,sumOfReverseFrequencyValues[i] - 1);
      range=0;
      while (value > reverseFrequency[range][i]) {
        value-=reverseFrequency[range][i];
        range++;
      }
    }
    frequency[range][i]++;
    sumOfFrequencyValues[i]++;
    double low=problem.getLowerBound(i) + range * (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    double high=low + (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    value=randomGenerator.nextDouble(low,high);
    solution.setVariableValue(i,value);
  }
  return solution;
}

Fixed version (ground truth):
/** 
 * Returns a <code>Solution</code> using the diversification generation method described in the scatter search template.
 * @throws javax.management.JMException
 * @throws ClassNotFoundException
 */
public DoubleSolution diversificationGeneration() throws JMException, ClassNotFoundException {
  DoubleSolution solution=problem.createSolution();
  double value;
  int range;
  for (int i=0; i < problem.getNumberOfVariables(); i++) {
    sumOfReverseFrequencyValues[i]=0;
    for (int j=0; j < numberOfSubranges; j++) {
      reverseFrequency[j][i]=sumOfFrequencyValues[i] - frequency[j][i];
      sumOfReverseFrequencyValues[i]+=reverseFrequency[j][i];
    }
    if (sumOfReverseFrequencyValues[i] == 0) {
      range=randomGenerator.nextInt(0,numberOfSubranges - 1);
    }
 else {
      value=randomGenerator.nextInt(0,sumOfReverseFrequencyValues[i] - 1);
      range=0;
      while (value > reverseFrequency[range][i]) {
        value-=reverseFrequency[range][i];
        range++;
      }
    }
    frequency[range][i]++;
    sumOfFrequencyValues[i]++;
    double low=problem.getLowerBound(i) + range * (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    double high=low + (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    value=randomGenerator.nextDouble(low,high);
    solution.setVariableValue(i,value);
  }
  return solution;
}
Program: 64617
Project: 64617
Buggy source:
private void initialListSolution(){
  try {
    DoubleSolution solution;
    for (int i=0; i < this.solutionSetSize; i++) {
      solution=super.diversificationGeneration();
      problem.evaluate(solution);
      if (problem instanceof ConstrainedProblem) {
        ((ConstrainedProblem)problem).evaluateConstraints(solution);
      }
      evaluations++;
      solution=(DoubleSolution)improvementOperator.execute(solution);
      marked.setAttribute(solution,false);
      strenghtRawFitness.setAttribute(solution,0.0);
      evaluations+=improvementOperator.getEvaluations();
      solutionSet.add(solution);
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}

Fixed version (ground truth):
private void initialListSolution(){
  try {
    DoubleSolution solution;
    for (int i=0; i < this.solutionSetSize; i++) {
      solution=super.diversificationGeneration();
      problem.evaluate(solution);
      if (problem instanceof ConstrainedProblem) {
        ((ConstrainedProblem)problem).evaluateConstraints(solution);
      }
      evaluations++;
      solution=(DoubleSolution)improvementOperator.execute(solution);
      marked.setAttribute(solution,false);
      if (strenghtRawFitness.getAttribute(solution) == null) {
        strenghtRawFitness.setAttribute(solution,0.0);
      }
      evaluations+=improvementOperator.getEvaluations();
      solutionSet.add(solution);
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
}
Program: 64618
Project: 64618
Buggy source:
public ABYSSBuilder(DoubleProblem problem,Archive archive){
  this.populationSize=20;
  this.maxEvaluations=25000;
  this.archiveSize=100;
  this.refSet1Size=10;
  this.refSet2Size=10;
  this.numberOfSubranges=4;
  this.problem=problem;
  double crossoverProbability=0.9;
  double distributionIndex=20.0;
  this.crossoverOperator=new SBXCrossover(crossoverProbability,distributionIndex);
  double mutationProbability=1 / problem.getNumberOfVariables();
  this.mutationOperator=new PolynomialMutation(mutationProbability,distributionIndex);
  int improvementRounds=1;
  this.improvementOperator=new MutationLocalSearch(improvementRounds,mutationOperator,archive.getSolutionList(),problem);
  this.archive=(CrowdingDistanceArchive)archive;
}

Fixed version (ground truth):
public ABYSSBuilder(DoubleProblem problem,Archive archive){
  this.populationSize=20;
  this.maxEvaluations=25000;
  this.archiveSize=100;
  this.refSet1Size=10;
  this.refSet2Size=10;
  this.numberOfSubranges=4;
  this.problem=problem;
  double crossoverProbability=0.9;
  double distributionIndex=20.0;
  this.crossoverOperator=new SBXCrossover(crossoverProbability,distributionIndex);
  double mutationProbability=1.0 / problem.getNumberOfVariables();
  this.mutationOperator=new PolynomialMutation(mutationProbability,distributionIndex);
  int improvementRounds=1;
  this.archive=(CrowdingDistanceArchive)archive;
  this.improvementOperator=new MutationLocalSearch(improvementRounds,mutationOperator,this.archive,problem);
}
Program: 64619
Project: 64619
Buggy source:
/** 
 * Returns a <code>Solution</code> using the diversification generation method described in the scatter search template.
 * @throws javax.management.JMException
 * @throws ClassNotFoundException
 */
public DoubleSolution diversificationGeneration() throws JMException, ClassNotFoundException {
  DoubleSolution solution=problem.createSolution();
  marked.setAttribute(solution,false);
  double value;
  int range;
  for (int i=0; i < problem.getNumberOfVariables(); i++) {
    sumOfReverseFrequencyValues[i]=0;
    for (int j=0; j < numberOfSubranges; j++) {
      reverseFrequency[j][i]=sumOfFrequencyValues[i] - frequency[j][i];
      sumOfReverseFrequencyValues[i]+=reverseFrequency[j][i];
    }
    if (sumOfReverseFrequencyValues[i] == 0) {
      range=randomGenerator.nextInt(0,numberOfSubranges - 1);
    }
 else {
      value=randomGenerator.nextInt(0,sumOfReverseFrequencyValues[i] - 1);
      range=0;
      while (value > reverseFrequency[range][i]) {
        value-=reverseFrequency[range][i];
        range++;
      }
    }
    frequency[range][i]++;
    sumOfFrequencyValues[i]++;
    double low=problem.getLowerBound(i) + range * (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    double high=low + (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    value=randomGenerator.nextDouble(low,high);
    solution.setVariableValue(i,value);
  }
  return solution;
}

Fixed version (ground truth):
/** 
 * Returns a <code>Solution</code> using the diversification generation method described in the scatter search template.
 * @throws javax.management.JMException
 * @throws ClassNotFoundException
 */
public DoubleSolution diversificationGeneration() throws JMException, ClassNotFoundException {
  DoubleSolution solution=problem.createSolution();
  marked.setAttribute(solution,false);
  strenghtRawFitness.setAttribute(solution,0.0);
  double value;
  int range;
  for (int i=0; i < problem.getNumberOfVariables(); i++) {
    sumOfReverseFrequencyValues[i]=0;
    for (int j=0; j < numberOfSubranges; j++) {
      reverseFrequency[j][i]=sumOfFrequencyValues[i] - frequency[j][i];
      sumOfReverseFrequencyValues[i]+=reverseFrequency[j][i];
    }
    if (sumOfReverseFrequencyValues[i] == 0) {
      range=randomGenerator.nextInt(0,numberOfSubranges - 1);
    }
 else {
      value=randomGenerator.nextInt(0,sumOfReverseFrequencyValues[i] - 1);
      range=0;
      while (value > reverseFrequency[range][i]) {
        value-=reverseFrequency[range][i];
        range++;
      }
    }
    frequency[range][i]++;
    sumOfFrequencyValues[i]++;
    double low=problem.getLowerBound(i) + range * (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    double high=low + (problem.getUpperBound(i) - problem.getLowerBound(i)) / numberOfSubranges;
    value=randomGenerator.nextDouble(low,high);
    solution.setVariableValue(i,value);
  }
  return solution;
}
Program: 64620
Project: 64620
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64621
Project: 64621
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64622
Project: 64622
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64623
Project: 64623
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64624
Project: 64624
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64625
Project: 64625
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64626
Project: 64626
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64627
Project: 64627
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64628
Project: 64628
Buggy source:
@Override public String getName(){
  return getName();
}

Fixed version (ground truth):
@Override public String getName(){
  return super.getName();
}
Program: 64629
Project: 64629
Buggy source:
@Override public int getNumberOfPoints(){
  return points.length;
}

Fixed version (ground truth):
@Override public int getNumberOfPoints(){
  return numberOfPoints;
}
Program: 64630
Project: 64630
Buggy source:
@Override public void sort(Comparator<Point> comparator){
  Arrays.sort(points,comparator);
}

Fixed version (ground truth):
@Override public void sort(Comparator<Point> comparator){
  Arrays.sort(points,0,numberOfPoints,comparator);
}
Program: 64631
Project: 64631
Buggy source:
@Test(expected=NullPointerException.class) public void shouldCreateInputStreamThrownAnExceptionIfFileDoesNotExist() throws FileNotFoundException {
  String fileName="String_Node_Str";
  Front front=new ArrayFront();
  front.readFrontFromFile(fileName);
}

Fixed version (ground truth):
@Test(expected=FileNotFoundException.class) public void shouldCreateInputStreamThrownAnExceptionIfFileDoesNotExist() throws FileNotFoundException {
  String fileName="String_Node_Str";
  Front front=new ArrayFront();
  front.readFrontFromFile(fileName);
}
Program: 64632
Project: 64632
Buggy source:
/** 
 * Initialize weight vectors
 */
protected void initializeUniformWeight(){
  if ((problem.getNumberOfObjectives() == 2) && (populationSize <= 300)) {
    for (int n=0; n < populationSize; n++) {
      double a=1.0 * n / (populationSize - 1);
      lambda[n][0]=a;
      lambda[n][1]=1 - a;
    }
  }
 else {
    String dataFileName;
    dataFileName="String_Node_Str" + problem.getNumberOfObjectives() + "String_Node_Str"+ populationSize+ "String_Node_Str";
    try {
      FileInputStream fis=new FileInputStream(this.getClass().getClassLoader().getResource(dataDirectory + "String_Node_Str" + dataFileName).getPath());
      InputStreamReader isr=new InputStreamReader(fis);
      BufferedReader br=new BufferedReader(isr);
      int i=0;
      int j=0;
      String aux=br.readLine();
      while (aux != null) {
        StringTokenizer st=new StringTokenizer(aux);
        j=0;
        while (st.hasMoreTokens()) {
          double value=new Double(st.nextToken());
          lambda[i][j]=value;
          j++;
        }
        aux=br.readLine();
        i++;
      }
      br.close();
    }
 catch (    Exception e) {
      throw new JMetalException("String_Node_Str" + dataDirectory + "String_Node_Str"+ dataFileName,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialize weight vectors
 */
protected void initializeUniformWeight(){
  if ((problem.getNumberOfObjectives() == 2) && (populationSize <= 300)) {
    for (int n=0; n < populationSize; n++) {
      double a=1.0 * n / (populationSize - 1);
      lambda[n][0]=a;
      lambda[n][1]=1 - a;
    }
  }
 else {
    String dataFileName;
    dataFileName="String_Node_Str" + problem.getNumberOfObjectives() + "String_Node_Str"+ populationSize+ "String_Node_Str";
    try {
      InputStream in=getClass().getResourceAsStream("String_Node_Str" + dataDirectory + "String_Node_Str"+ dataFileName);
      InputStreamReader isr=new InputStreamReader(in);
      BufferedReader br=new BufferedReader(isr);
      int i=0;
      int j=0;
      String aux=br.readLine();
      while (aux != null) {
        StringTokenizer st=new StringTokenizer(aux);
        j=0;
        while (st.hasMoreTokens()) {
          double value=new Double(st.nextToken());
          lambda[i][j]=value;
          j++;
        }
        aux=br.readLine();
        i++;
      }
      br.close();
    }
 catch (    Exception e) {
      throw new JMetalException("String_Node_Str" + dataDirectory + "String_Node_Str"+ dataFileName,e);
    }
  }
}