nus-yam/ex-repair huggingface dataset:
Program: 180757
Project: 180757
Buggy source:
/** 
 * Will use grow initialisation on half the population and full on the other half. If  the population size is an odd number then the extra individual will be initialised with grow.
 */
public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  int startDepth=2;
  int endDepth=model.getInitialMaxDepth();
  if (endDepth < 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double programsPerDepth=(double)popSize / (endDepth - startDepth + 1);
  for (int i=0; i < popSize; i++) {
    int depth=(int)Math.floor((firstGen.size() / programsPerDepth) + startDepth);
    System.out.println(depth);
    CandidateProgram<TYPE> program;
    do {
      Node<TYPE> rootNode;
      if ((i % 2) == 0) {
        rootNode=grow.buildGrowNodeTree(depth);
      }
 else {
        rootNode=full.buildFullNodeTree(depth);
      }
      program=new CandidateProgram<TYPE>(rootNode,model);
    }
 while (firstGen.contains(program));
    firstGen.add(program);
  }
  return firstGen;
}

Fixed version (ground truth):
/** 
 * Will use grow initialisation on half the population and full on the other half. If  the population size is an odd number then the extra individual will be initialised with grow.
 */
public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  int startDepth=2;
  int endDepth=model.getInitialMaxDepth();
  if (endDepth < 2) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  double programsPerDepth=(double)popSize / (endDepth - startDepth + 1);
  for (int i=0; i < popSize; i++) {
    int depth=(int)Math.floor((firstGen.size() / programsPerDepth) + startDepth);
    CandidateProgram<TYPE> program;
    do {
      Node<TYPE> rootNode;
      if ((i % 2) == 0) {
        rootNode=grow.buildGrowNodeTree(depth);
      }
 else {
        rootNode=full.buildFullNodeTree(depth);
      }
      program=new CandidateProgram<TYPE>(rootNode,model);
    }
 while (firstGen.contains(program));
    firstGen.add(program);
  }
  return firstGen;
}
Program: 180758
Project: 180758
Buggy source:
private void fillChildren(Node<TYPE> topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (currentDepth < maxDepth) {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
      Node<TYPE> child=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
      topNode.setChild(child,i);
      fillChildren(child,(currentDepth + 1),maxDepth);
    }
  }
 else {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * model.getTerminals().size());
      Node<TYPE> child=(Node<TYPE>)model.getTerminals().get(randomIndex).clone();
      topNode.setChild(child,i);
    }
  }
}

Fixed version (ground truth):
private void fillChildren(Node<TYPE> topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (currentDepth < maxDepth - 1) {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
      Node<TYPE> child=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
      topNode.setChild(child,i);
      fillChildren(child,(currentDepth + 1),maxDepth);
    }
  }
 else {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * model.getTerminals().size());
      Node<TYPE> child=(Node<TYPE>)model.getTerminals().get(randomIndex).clone();
      topNode.setChild(child,i);
    }
  }
}
Program: 180759
Project: 180759
Buggy source:
private void fillChildren(Node<TYPE> topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (arity > 0) {
    if (currentDepth < maxDepth) {
      for (int i=0; i < arity; i++) {
        int randomIndex=(int)Math.floor(Math.random() * model.getSyntax().size());
        Node<TYPE> child=(Node<TYPE>)model.getSyntax().get(randomIndex).clone();
        topNode.setChild(child,i);
        this.fillChildren(child,(currentDepth + 1),maxDepth);
      }
    }
 else {
      for (int i=0; i < arity; i++) {
        int randomIndex=(int)Math.floor(Math.random() * model.getTerminals().size());
        Node<TYPE> child=(Node<TYPE>)model.getTerminals().get(randomIndex).clone();
        topNode.setChild(child,i);
      }
    }
  }
}

Fixed version (ground truth):
private void fillChildren(Node<TYPE> topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (arity > 0) {
    if (currentDepth < maxDepth - 1) {
      for (int i=0; i < arity; i++) {
        int randomIndex=(int)Math.floor(Math.random() * model.getSyntax().size());
        Node<TYPE> child=(Node<TYPE>)model.getSyntax().get(randomIndex).clone();
        topNode.setChild(child,i);
        this.fillChildren(child,(currentDepth + 1),maxDepth);
      }
    }
 else {
      for (int i=0; i < arity; i++) {
        int randomIndex=(int)Math.floor(Math.random() * model.getTerminals().size());
        Node<TYPE> child=(Node<TYPE>)model.getTerminals().get(randomIndex).clone();
        topNode.setChild(child,i);
      }
    }
  }
}
Program: 180760
Project: 180760
Buggy source:
public int getDepth(){
  return countDepth(this,1,0);
}

Fixed version (ground truth):
public int getDepth(){
  return countDepth(this,0,0);
}
Program: 180761
Project: 180761
Buggy source:
/** 
 * Build a FULL node tree
 * @param depth The maximum depth of the node tree
 * @return The FULL node tree
 */
public Node<TYPE> buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
  Node<TYPE> top=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
  fillChildren(top,0,model.getInitialMaxDepth());
  return top;
}

Fixed version (ground truth):
/** 
 * Build a FULL node tree
 * @param depth The maximum depth of the node tree
 * @return The FULL node tree
 */
public Node<TYPE> buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
  Node<TYPE> top=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
  fillChildren(top,0,depth);
  return top;
}
Program: 180762
Project: 180762
Buggy source:
/** 
 * Build a FULL node tree
 * @param depth The maximum depth of the node tree
 * @return The FULL node tree
 */
public Node<TYPE> buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
  Node<TYPE> top=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
  fillChildren(top,1,model.getInitialMaxDepth());
  return top;
}

Fixed version (ground truth):
/** 
 * Build a FULL node tree
 * @param depth The maximum depth of the node tree
 * @return The FULL node tree
 */
public Node<TYPE> buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getFunctions().size());
  Node<TYPE> top=(Node<TYPE>)model.getFunctions().get(randomIndex).clone();
  fillChildren(top,0,model.getInitialMaxDepth());
  return top;
}
Program: 180763
Project: 180763
Buggy source:
/** 
 * Builds a GROW generated node tree
 * @param depth The maximum depth of the node tree
 * @return The node tree
 */
public Node<TYPE> buildGrowNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getSyntax().size());
  Node<TYPE> top=(Node<TYPE>)model.getSyntax().get(randomIndex).clone();
  this.fillChildren(top,1,depth);
  return top;
}

Fixed version (ground truth):
/** 
 * Builds a GROW generated node tree
 * @param depth The maximum depth of the node tree
 * @return The node tree
 */
public Node<TYPE> buildGrowNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * model.getSyntax().size());
  Node<TYPE> top=(Node<TYPE>)model.getSyntax().get(randomIndex).clone();
  this.fillChildren(top,0,depth);
  return top;
}
Program: 180764
Project: 180764
Buggy source:
/** 
 * @param model The model being assessed
 * @param semMod The semantic module for this model
 */
public RampedHalfAndHalfInitialiser(GPModel<TYPE> model){
  this.model=model;
  grow=new GrowInitialiser<TYPE>(model);
  full=new FullInitialiser<TYPE>(model);
  if (model.getInitialMaxDepth() >= 6) {
    this.depth=model.getInitialMaxDepth() - 4;
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * @param model The model being assessed
 * @param semMod The semantic module for this model
 */
public RampedHalfAndHalfInitialiser(GPModel<TYPE> model){
  this.model=model;
  grow=new GrowInitialiser<TYPE>(model);
  full=new FullInitialiser<TYPE>(model);
}
Program: 180765
Project: 180765
Buggy source:
/** 
 * Will use grow initialisation on half the population and full on the other half. If  the population size is an odd number then the extra individual will be initialised with grow.
 */
public List<CandidateProgram<TYPE>> getInitialPopulation(){
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  int split=popSize / 5;
  int marker=popSize / 5;
  for (int i=0; i < popSize; i++) {
    if (i > split) {
      depth++;
      split=split + marker;
    }
    if (((i % 2) == 0)) {
      candidate=new CandidateProgram<TYPE>(grow.buildGrowNodeTree(depth),model);
      while (firstGen.contains(candidate)) {
        candidate=new CandidateProgram<TYPE>(grow.buildGrowNodeTree(depth),model);
      }
    }
 else {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(depth),model);
      while (firstGen.contains(candidate)) {
        candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(depth),model);
      }
    }
    firstGen.add(candidate);
  }
  return firstGen;
}

Fixed version (ground truth):
/** 
 * Will use grow initialisation on half the population and full on the other half. If  the population size is an odd number then the extra individual will be initialised with grow.
 */
public List<CandidateProgram<TYPE>> getInitialPopulation(){
  if (model.getInitialMaxDepth() >= 6) {
    this.depth=model.getInitialMaxDepth() - 4;
  }
 else {
    throw new IllegalArgumentException("String_Node_Str");
  }
  int popSize=model.getPopulationSize();
  List<CandidateProgram<TYPE>> firstGen=new ArrayList<CandidateProgram<TYPE>>(popSize);
  int split=popSize / 5;
  int marker=popSize / 5;
  for (int i=0; i < popSize; i++) {
    if (i > split) {
      depth++;
      split=split + marker;
    }
    if (((i % 2) == 0)) {
      candidate=new CandidateProgram<TYPE>(grow.buildGrowNodeTree(depth),model);
      while (firstGen.contains(candidate)) {
        candidate=new CandidateProgram<TYPE>(grow.buildGrowNodeTree(depth),model);
      }
    }
 else {
      candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(depth),model);
      while (firstGen.contains(candidate)) {
        candidate=new CandidateProgram<TYPE>(full.buildFullNodeTree(depth),model);
      }
    }
    firstGen.add(candidate);
  }
  return firstGen;
}
Program: 180766
Project: 180766
Buggy source:
/** 
 * Gets the best CandidatePrograms from the given population and returns  them. The number of programs returned will be either noElites or pop.size() if the size of the given population is smaller than noElites. Elites in  are defined as the very best programs in a population.
 * @param < TYPE > 	the return type of the CandidatePrograms being used.
 * @param pop	 	the population from which elites need to be retrieved.
 * @param noElites	the number of elites to obtain.
 * @return a list containing the noElites best CandidatePrograms determined by fitness. If noElites is less than the population  size then the returned list will contain all CandidatePrograms  from the population.
 */
public static <TYPE>List<CandidateProgram<TYPE>> getElites(List<CandidateProgram<TYPE>> pop,int noElites){
  List<CandidateProgram<TYPE>> elites=new ArrayList<CandidateProgram<TYPE>>(noElites);
  if (noElites > 0) {
    Collections.sort(pop);
    elites.addAll(pop.subList(pop.size() - noElites,pop.size() - 1));
  }
  return elites;
}

Fixed version (ground truth):
/** 
 * Gets the best CandidatePrograms from the given population and returns  them. The number of programs returned will be either noElites or pop.size() if the size of the given population is smaller than noElites. Elites in  are defined as the very best programs in a population.
 * @param < TYPE > 	the return type of the CandidatePrograms being used.
 * @param pop	 	the population from which elites need to be retrieved.
 * @param noElites	the number of elites to obtain.
 * @return a list containing the noElites best CandidatePrograms determined by fitness. If noElites is less than the population  size then the returned list will contain all CandidatePrograms  from the population.
 */
public static <TYPE>List<CandidateProgram<TYPE>> getElites(List<CandidateProgram<TYPE>> pop,int noElites){
  List<CandidateProgram<TYPE>> elites=new ArrayList<CandidateProgram<TYPE>>(noElites);
  if (noElites > 0) {
    Collections.sort(pop);
    elites.addAll(pop.subList(pop.size() - noElites,pop.size()));
  }
  return elites;
}
Program: 180767
Project: 180767
Buggy source:
/** 
 * Adds to signed polynomials to the simplification tool
 * @param polynomialToAdd
 */
public void addPolynomial(CoefficientVariablePowerFunction polynomialToAdd){
  listOfPolynomials.add(polynomialToAdd);
}

Fixed version (ground truth):
/** 
 * Adds to signed polynomials to the simplification tool
 * @param polynomialToAdd
 */
public void addPolynomial(CoefficientExponentFunction polynomialToAdd){
  listOfPolynomials.add(polynomialToAdd);
}
Program: 180768
Project: 180768
Buggy source:
/** 
 * Constructor for RegressionCVPSimplificationTool
 */
public RegressionCVPSimplificationTool(){
  listOfPolynomials=new ArrayList<CoefficientVariablePowerFunction>();
}

Fixed version (ground truth):
/** 
 * Constructor for RegressionCVPSimplificationTool
 */
public RegressionCVPSimplificationTool(){
  listOfPolynomials=new ArrayList<CoefficientExponentFunction>();
}
Program: 180770
Project: 180770
Buggy source:
public GPConfig(){
  noRuns=1;
  noGenerations=1;
  populationSize=10;
  maxDepth=4;
  crossoverProbability=1;
  reproductionProbability=0;
  terminals=new ArrayList<TerminalNode<?>>();
  functions=new ArrayList<FunctionNode<?>>();
  initialiser=new FullInitialiser(this);
  crossover=new UniformPointCrossover(this);
}

Fixed version (ground truth):
public GPConfig(){
  noRuns=1;
  noGenerations=10;
  populationSize=10;
  maxDepth=4;
  crossoverProbability=1;
  reproductionProbability=0;
  terminals=new ArrayList<TerminalNode<?>>();
  functions=new ArrayList<FunctionNode<?>>();
  initialiser=new FullInitialiser(this);
  crossover=new UniformPointCrossover(this);
}
Program: 180771
Project: 180771
Buggy source:
public static int getProgramLength(Node rootNode){
  return GPProgramAnalyser.countLength(rootNode,0);
}

Fixed version (ground truth):
/** 
 * ALTERNATIVE IMPLEMENTATION Calculates the length - that is the number of nodes - of the program.
 * @param prog The program to be measured
 * @return The length of the program
 */
public static int getProgramLength(Node rootNode){
  return GPProgramAnalyser.countLength(rootNode,0);
}
Program: 180772
Project: 180772
Buggy source:
private void outputProgram(CandidateProgram program){
  System.out.println("String_Node_Str");
  System.out.println(program);
  System.out.println(model.getFitness(program));
  System.out.println("String_Node_Str" + GPProgramAnalyser.getProgramDepth(program));
  System.out.println("String_Node_Str" + GPProgramAnalyser.getProgramLength(program));
}

Fixed version (ground truth):
private void outputProgram(CandidateProgram program){
  System.out.println("String_Node_Str");
  System.out.println(program);
  System.out.println("String_Node_Str" + model.getFitness(program));
  System.out.println("String_Node_Str" + GPProgramAnalyser.getProgramDepth(program));
  System.out.println("String_Node_Str" + GPProgramAnalyser.getProgramLength(program));
}
Program: 180773
Project: 180773
Buggy source:
@Override public CandidateProgram[] crossover(CandidateProgram parent1,CandidateProgram parent2){
  CandidateProgram child1=null;
  CandidateProgram child2=null;
  try {
    child1=(CandidateProgram)parent1.clone();
    child2=(CandidateProgram)parent2.clone();
  }
 catch (  CloneNotSupportedException e1) {
    e1.printStackTrace();
  }
  if (Math.random() < config.getCrossoverProbability()) {
    int swapPoint1=(int)Math.floor(Math.random() * GPProgramAnalyser.getProgramLength(parent1));
    int swapPoint2=(int)Math.floor(Math.random() * GPProgramAnalyser.getProgramLength(parent2));
    if (swapPoint1 == 0 || swapPoint2 == 0) {
      System.out.println("String_Node_Str");
    }
    try {
      Node subTree1=(Node)child1.getNthNode(swapPoint1).clone();
      Node subTree2=(Node)child2.getNthNode(swapPoint2).clone();
      child1.setNthNode(subTree2,swapPoint1);
      child2.setNthNode(subTree1,swapPoint2);
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
    int pDepth1=GPProgramAnalyser.getProgramDepth(child1);
    int pDepth2=GPProgramAnalyser.getProgramDepth(child2);
    if (pDepth1 > config.getMaxDepth()) {
      try {
        child1=(CandidateProgram)parent1.clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
    }
    if (pDepth2 > config.getMaxDepth()) {
      try {
        child2=(CandidateProgram)parent2.clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
    }
  }
  return new CandidateProgram[]{child1,child2};
}

Fixed version (ground truth):
@Override public CandidateProgram[] crossover(CandidateProgram parent1,CandidateProgram parent2){
  CandidateProgram child1=null;
  CandidateProgram child2=null;
  try {
    child1=(CandidateProgram)parent1.clone();
    child2=(CandidateProgram)parent2.clone();
  }
 catch (  CloneNotSupportedException e1) {
    e1.printStackTrace();
  }
  if (Math.random() < config.getCrossoverProbability()) {
    int swapPoint1=(int)Math.floor(Math.random() * GPProgramAnalyser.getProgramLength(parent1));
    int swapPoint2=(int)Math.floor(Math.random() * GPProgramAnalyser.getProgramLength(parent2));
    try {
      Node subTree1=(Node)child1.getNthNode(swapPoint1).clone();
      Node subTree2=(Node)child2.getNthNode(swapPoint2).clone();
      child1.setNthNode(subTree2,swapPoint1);
      child2.setNthNode(subTree1,swapPoint2);
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
    int pDepth1=GPProgramAnalyser.getProgramDepth(child1);
    int pDepth2=GPProgramAnalyser.getProgramDepth(child2);
    if (pDepth1 > config.getMaxDepth()) {
      try {
        child1=(CandidateProgram)parent1.clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
    }
    if (pDepth2 > config.getMaxDepth()) {
      try {
        child2=(CandidateProgram)parent2.clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
    }
  }
  return new CandidateProgram[]{child1,child2};
}
Program: 180774
Project: 180774
Buggy source:
private void fillChildren(Node topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (currentDepth < maxDepth - 1) {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * config.getFunctions().size());
      Node child=null;
      try {
        child=(Node)config.getFunctions().get(randomIndex).clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
      topNode.setChild(child,i);
      this.fillChildren(child,(currentDepth + 1),maxDepth);
    }
  }
 else {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * config.getTerminals().size());
      Node child=null;
      try {
        child=(Node)config.getTerminals().get(randomIndex).clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
      topNode.setChild(child,i);
    }
  }
}

Fixed version (ground truth):
private void fillChildren(Node topNode,int currentDepth,int maxDepth){
  int arity=topNode.getArity();
  if (currentDepth < maxDepth - 1) {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * config.getFunctions().size());
      Node child=null;
      try {
        child=(Node)config.getFunctions().get(randomIndex).clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
      topNode.setChild(child,i);
      fillChildren(child,(currentDepth + 1),maxDepth);
    }
  }
 else {
    for (int i=0; i < arity; i++) {
      int randomIndex=(int)Math.floor(Math.random() * config.getTerminals().size());
      Node child=null;
      try {
        child=(Node)config.getTerminals().get(randomIndex).clone();
      }
 catch (      CloneNotSupportedException e) {
        e.printStackTrace();
      }
      topNode.setChild(child,i);
    }
  }
}
Program: 180775
Project: 180775
Buggy source:
@Override public Object clone() throws CloneNotSupportedException {
  Node<TYPE> clone=(Node<TYPE>)super.clone();
  clone.setChildren(this.children.clone());
  return clone;
}

Fixed version (ground truth):
@Override public Object clone() throws CloneNotSupportedException {
  Node<TYPE> clone=(Node<TYPE>)super.clone();
  clone.children=this.children.clone();
  for (int i=0; i < children.length; i++) {
    clone.children[i]=this.children[i];
    if (clone.children[i] != null)     clone.children[i]=(Node<?>)clone.children[i].clone();
  }
  return clone;
}
Program: 180776
Project: 180776
Buggy source:
public void run(GPModel<TYPE> model){
  this.model=model;
  GPCrossover crossover=new GPCrossover(model);
  Initialiser init=model.getInitialiser();
  List<CandidateProgram<TYPE>> pop=init.getInitialPopulation();
  double bestFitness=Double.POSITIVE_INFINITY;
  CandidateProgram<?> bestProgram=null;
  for (int i=1; i <= model.getNoGenerations(); i++) {
    List<CandidateProgram<TYPE>> nextPop=new ArrayList<CandidateProgram<TYPE>>();
    List<CandidateProgram<TYPE>> poule=model.getPouleSelector().getPoule(pop,model.getPouleSize());
    while (nextPop.size() < model.getPopulationSize()) {
      double random=Math.random();
      double pr=model.getReproductionProbability();
      double pe=model.getCrossoverProbability();
      if (random < pr) {
        nextPop.add(poule.get((int)Math.floor(Math.random() * poule.size())));
      }
 else       if (random < pr + pe) {
        CandidateProgram<TYPE>[] children=crossover.crossover(poule);
        for (        CandidateProgram<TYPE> c : children) {
          if (nextPop.size() < model.getPopulationSize())           nextPop.add(c);
        }
      }
 else {
      }
    }
    for (    CandidateProgram<TYPE> p : pop) {
      double fitness=model.getFitness(p);
      if (fitness < bestFitness) {
        bestFitness=fitness;
        bestProgram=p;
      }
    }
    pop=nextPop;
  }
  System.out.println("String_Node_Str" + bestProgram);
  System.out.println("String_Node_Str" + bestFitness);
  System.out.println();
}

Fixed version (ground truth):
public void run(GPModel<TYPE> model){
  this.model=model;
  GPCrossover<TYPE> crossover=new GPCrossover<TYPE>(model);
  Initialiser<TYPE> init=model.getInitialiser();
  List<CandidateProgram<TYPE>> pop=init.getInitialPopulation();
  double bestFitness=Double.POSITIVE_INFINITY;
  CandidateProgram<?> bestProgram=null;
  for (int i=1; i <= model.getNoGenerations(); i++) {
    List<CandidateProgram<TYPE>> nextPop=new ArrayList<CandidateProgram<TYPE>>();
    List<CandidateProgram<TYPE>> poule=model.getPouleSelector().getPoule(pop,model.getPouleSize());
    while (nextPop.size() < model.getPopulationSize()) {
      double random=Math.random();
      double pr=model.getReproductionProbability();
      double pe=model.getCrossoverProbability();
      if (random < pr) {
        nextPop.add(poule.get((int)Math.floor(Math.random() * poule.size())));
      }
 else       if (random < pr + pe) {
        CandidateProgram<TYPE>[] children=crossover.crossover(poule);
        for (        CandidateProgram<TYPE> c : children) {
          if (nextPop.size() < model.getPopulationSize())           nextPop.add(c);
        }
      }
 else {
      }
    }
    for (    CandidateProgram<TYPE> p : pop) {
      double fitness=model.getFitness(p);
      if (fitness < bestFitness) {
        bestFitness=fitness;
        bestProgram=p;
      }
    }
    pop=nextPop;
  }
  System.out.println("String_Node_Str" + bestProgram);
  System.out.println("String_Node_Str" + bestFitness);
  System.out.println();
}
Program: 180777
Project: 180777
Buggy source:
@Override public TYPE evaluate(){
  return value;
}

Fixed version (ground truth):
@Override public TYPE evaluate(){
  return getValue();
}
Program: 180778
Project: 180778
Buggy source:
@Override public List<TerminalNode<?>> getTerminals(){
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  List<TerminalNode<?>> terminals=new ArrayList<TerminalNode<?>>();
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  return terminals;
}

Fixed version (ground truth):
@Override public List<TerminalNode<?>> getTerminals(){
  List<TerminalNode<?>> terminals=new ArrayList<TerminalNode<?>>();
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  terminals.add(variables.get("String_Node_Str"));
  return terminals;
}
Program: 180779
Project: 180779
Buggy source:
public void configure(){
  setPopulationSize(500);
  setNoGenerations(50);
  setCrossoverProbability(0.9);
  setReproductionProbability(0.1);
  setNoRuns(10);
  setPouleSize(50);
  setNoElites(50);
  setMaxDepth(4);
  setPouleSelector(new TournamentSelector<Boolean>(7,this));
  setParentSelector(new RandomParentSelector<Boolean>());
  setCrossover(new UniformPointCrossover<Boolean>(this));
}

Fixed version (ground truth):
public void configure(){
  setPopulationSize(500);
  setNoGenerations(50);
  setCrossoverProbability(0.9);
  setReproductionProbability(0.1);
  setNoRuns(10);
  setPouleSize(50);
  setNoElites(50);
  setMaxDepth(6);
  setPouleSelector(new TournamentSelector<Boolean>(7,this));
  setParentSelector(new RandomParentSelector<Boolean>());
  setCrossover(new UniformPointCrossover<Boolean>(this));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
  variables.put("String_Node_Str",new Variable<Boolean>("String_Node_Str"));
}
Program: 180780
Project: 180780
Buggy source:
public Node buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * config.getFunctions().size());
  Node top=config.getFunctions().get(randomIndex);
  fillChildren(top,1,config.getDepth());
  return top;
}

Fixed version (ground truth):
public Node buildFullNodeTree(int depth){
  int randomIndex=(int)Math.floor(Math.random() * config.getFunctions().size());
  Node top=null;
  try {
    top=(Node)config.getFunctions().get(randomIndex).clone();
  }
 catch (  CloneNotSupportedException e) {
    e.printStackTrace();
  }
  fillChildren(top,1,config.getDepth());
  return top;
}
Program: 180781
Project: 180781
Buggy source:
@Override public Object clone() throws CloneNotSupportedException {
  Node<TYPE> clone=(Node<TYPE>)super.clone();
  clone.setChildren(children.clone());
  return clone;
}

Fixed version (ground truth):
@Override public Object clone() throws CloneNotSupportedException {
  Node<TYPE> clone=(Node<TYPE>)super.clone();
  clone.setChildren(this.children.clone());
  return clone;
}
Program: 180784
Project: 180784
Buggy source:
void init(int width){
  if (width > 0) {
    mTicks=new int[width + 2];
  }
 else {
    mTicks=null;
  }
  mNumTicks=0;
  mLastBin=0;
}

Fixed version (ground truth):
void init(int width){
  if (width > 0) {
    mTicks=new int[width * 2];
  }
 else {
    mTicks=null;
  }
  mNumTicks=0;
  mLastBin=0;
}
Program: 180785
Project: 180785
Buggy source:
void addTick(int x,int bin){
  if (bin != mLastBin) {
    mTicks[mNumTicks]=x | bin << CHART_DATA_BIN_SHIFT;
    mNumTicks++;
    mLastBin=bin;
  }
}

Fixed version (ground truth):
void addTick(int x,int bin){
  if (bin != mLastBin && mNumTicks < mTicks.length) {
    mTicks[mNumTicks]=x | bin << CHART_DATA_BIN_SHIFT;
    mNumTicks++;
    mLastBin=bin;
  }
}
Program: 180786
Project: 180786
Buggy source:
void removePackage(String pkgName){
synchronized (mEntriesMap) {
    int idx=indexOfApplicationInfoLocked(pkgName);
    if (DEBUG)     Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ idx);
    if (idx >= 0) {
      AppEntry entry=mEntriesMap.get(pkgName);
      if (DEBUG)       Log.i(TAG,"String_Node_Str" + entry);
      if (entry != null) {
        mEntriesMap.remove(pkgName);
        mAppEntries.remove(entry);
      }
      mApplications.remove(idx);
      if (!mMainHandler.hasMessages(MainHandler.MSG_PACKAGE_LIST_CHANGED)) {
        mMainHandler.sendEmptyMessage(MainHandler.MSG_PACKAGE_LIST_CHANGED);
      }
    }
  }
}

Fixed version (ground truth):
void removePackage(String pkgName){
synchronized (mEntriesMap) {
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
    int idx=indexOfApplicationInfoLocked(pkgName);
    if (DEBUG)     Log.i(TAG,"String_Node_Str" + pkgName + "String_Node_Str"+ idx);
    if (idx >= 0) {
      AppEntry entry=mEntriesMap.get(pkgName);
      if (DEBUG)       Log.i(TAG,"String_Node_Str" + entry);
      if (entry != null) {
        mEntriesMap.remove(pkgName);
        mAppEntries.remove(entry);
      }
      mApplications.remove(idx);
      if (!mMainHandler.hasMessages(MainHandler.MSG_PACKAGE_LIST_CHANGED)) {
        mMainHandler.sendEmptyMessage(MainHandler.MSG_PACKAGE_LIST_CHANGED);
      }
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
}
Program: 180787
Project: 180787
Buggy source:
private ApplicationsState(Application app){
  mContext=app;
  mPm=mContext.getPackageManager();
  mThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_BACKGROUND);
  mThread.start();
  mBackgroundHandler=new BackgroundHandler(mThread.getLooper());
}

Fixed version (ground truth):
private ApplicationsState(Application app){
  mContext=app;
  mPm=mContext.getPackageManager();
  mThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_BACKGROUND);
  mThread.start();
  mBackgroundHandler=new BackgroundHandler(mThread.getLooper());
synchronized (mEntriesMap) {
    try {
      mEntriesMap.wait(1);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 180788
Project: 180788
Buggy source:
void addPackage(String pkgName){
  try {
synchronized (mEntriesMap) {
      if (DEBUG)       Log.i(TAG,"String_Node_Str" + pkgName);
      if (!mResumed) {
        return;
      }
      if (indexOfApplicationInfoLocked(pkgName) >= 0) {
        if (DEBUG)         Log.i(TAG,"String_Node_Str");
        return;
      }
      ApplicationInfo info=mPm.getApplicationInfo(pkgName,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
      mApplications.add(info);
      if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
        mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
      }
      if (!mMainHandler.hasMessages(MainHandler.MSG_PACKAGE_LIST_CHANGED)) {
        mMainHandler.sendEmptyMessage(MainHandler.MSG_PACKAGE_LIST_CHANGED);
      }
    }
  }
 catch (  NameNotFoundException e) {
  }
}

Fixed version (ground truth):
void addPackage(String pkgName){
  try {
synchronized (mEntriesMap) {
      if (DEBUG_LOCKING)       Log.v(TAG,"String_Node_Str");
      if (DEBUG)       Log.i(TAG,"String_Node_Str" + pkgName);
      if (!mResumed) {
        if (DEBUG_LOCKING)         Log.v(TAG,"String_Node_Str");
        return;
      }
      if (indexOfApplicationInfoLocked(pkgName) >= 0) {
        if (DEBUG)         Log.i(TAG,"String_Node_Str");
        if (DEBUG_LOCKING)         Log.v(TAG,"String_Node_Str");
        return;
      }
      ApplicationInfo info=mPm.getApplicationInfo(pkgName,PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
      mApplications.add(info);
      if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
        mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
      }
      if (!mMainHandler.hasMessages(MainHandler.MSG_PACKAGE_LIST_CHANGED)) {
        mMainHandler.sendEmptyMessage(MainHandler.MSG_PACKAGE_LIST_CHANGED);
      }
      if (DEBUG_LOCKING)       Log.v(TAG,"String_Node_Str");
    }
  }
 catch (  NameNotFoundException e) {
  }
}
Program: 180790
Project: 180790
Buggy source:
long sumCacheSizes(){
  long sum=0;
synchronized (mEntriesMap) {
    for (int i=mAppEntries.size() - 1; i >= 0; i--) {
      sum+=mAppEntries.get(i).cacheSize;
    }
  }
  return sum;
}

Fixed version (ground truth):
long sumCacheSizes(){
  long sum=0;
  if (DEBUG_LOCKING)   Log.v(TAG,"String_Node_Str");
synchronized (mEntriesMap) {
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
    for (int i=mAppEntries.size() - 1; i >= 0; i--) {
      sum+=mAppEntries.get(i).cacheSize;
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
  return sum;
}
Program: 180791
Project: 180791
Buggy source:
AppEntry getEntry(String packageName){
synchronized (mEntriesMap) {
    AppEntry entry=mEntriesMap.get(packageName);
    if (entry == null) {
      for (int i=0; i < mApplications.size(); i++) {
        ApplicationInfo info=mApplications.get(i);
        if (packageName.equals(info.packageName)) {
          entry=getEntryLocked(info);
          break;
        }
      }
    }
    return entry;
  }
}

Fixed version (ground truth):
AppEntry getEntry(String packageName){
  if (DEBUG_LOCKING)   Log.v(TAG,"String_Node_Str");
synchronized (mEntriesMap) {
    AppEntry entry=mEntriesMap.get(packageName);
    if (entry == null) {
      for (int i=0; i < mApplications.size(); i++) {
        ApplicationInfo info=mApplications.get(i);
        if (packageName.equals(info.packageName)) {
          entry=getEntryLocked(info);
          break;
        }
      }
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
    return entry;
  }
}
Program: 180792
Project: 180792
Buggy source:
void resume(Callbacks callbacks){
synchronized (mEntriesMap) {
    mCurCallbacks=callbacks;
    mResumed=true;
    if (mPackageIntentReceiver == null) {
      mPackageIntentReceiver=new PackageIntentReceiver();
      mPackageIntentReceiver.registerReceiver();
    }
    mApplications=mPm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
    if (mApplications == null) {
      mApplications=new ArrayList<ApplicationInfo>();
    }
    for (int i=0; i < mAppEntries.size(); i++) {
      mAppEntries.get(i).sizeStale=true;
    }
    for (int i=0; i < mApplications.size(); i++) {
      final ApplicationInfo info=mApplications.get(i);
      final AppEntry entry=mEntriesMap.get(info.packageName);
      if (entry != null) {
        entry.info=info;
      }
    }
    mCurComputingSizePkg=null;
    if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
      mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
    }
  }
}

Fixed version (ground truth):
void resume(Callbacks callbacks){
  if (DEBUG_LOCKING)   Log.v(TAG,"String_Node_Str");
synchronized (mEntriesMap) {
    mCurCallbacks=callbacks;
    mResumed=true;
    if (mPackageIntentReceiver == null) {
      mPackageIntentReceiver=new PackageIntentReceiver();
      mPackageIntentReceiver.registerReceiver();
    }
    mApplications=mPm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES | PackageManager.GET_DISABLED_COMPONENTS);
    if (mApplications == null) {
      mApplications=new ArrayList<ApplicationInfo>();
    }
    for (int i=0; i < mAppEntries.size(); i++) {
      mAppEntries.get(i).sizeStale=true;
    }
    for (int i=0; i < mApplications.size(); i++) {
      final ApplicationInfo info=mApplications.get(i);
      final AppEntry entry=mEntriesMap.get(info.packageName);
      if (entry != null) {
        entry.info=info;
      }
    }
    mCurComputingSizePkg=null;
    if (!mBackgroundHandler.hasMessages(BackgroundHandler.MSG_LOAD_ENTRIES)) {
      mBackgroundHandler.sendEmptyMessage(BackgroundHandler.MSG_LOAD_ENTRIES);
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
}
Program: 180794
Project: 180794
Buggy source:
void pause(){
synchronized (mEntriesMap) {
    mCurCallbacks=null;
    mResumed=false;
  }
}

Fixed version (ground truth):
void pause(){
  if (DEBUG_LOCKING)   Log.v(TAG,"String_Node_Str");
synchronized (mEntriesMap) {
    mCurCallbacks=null;
    mResumed=false;
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
}
Program: 180795
Project: 180795
Buggy source:
public void onGetStatsCompleted(PackageStats stats,boolean succeeded){
  boolean sizeChanged=false;
synchronized (mEntriesMap) {
    AppEntry entry=mEntriesMap.get(stats.packageName);
    if (entry != null) {
synchronized (entry) {
        entry.sizeStale=false;
        entry.sizeLoadStart=0;
        long newSize=getTotalSize(stats);
        if (entry.size != newSize || entry.cacheSize != stats.cacheSize || entry.codeSize != stats.codeSize || entry.dataSize != stats.dataSize) {
          entry.size=newSize;
          entry.cacheSize=stats.cacheSize;
          entry.codeSize=stats.codeSize;
          entry.dataSize=stats.dataSize;
          entry.sizeStr=getSizeStr(entry.size);
          if (DEBUG)           Log.i(TAG,"String_Node_Str" + entry.label + "String_Node_Str"+ entry+ "String_Node_Str"+ entry.sizeStr);
          sizeChanged=true;
        }
      }
      if (sizeChanged) {
        Message msg=mMainHandler.obtainMessage(MainHandler.MSG_PACKAGE_SIZE_CHANGED,stats.packageName);
        mMainHandler.sendMessage(msg);
      }
    }
    if (mCurComputingSizePkg == null || mCurComputingSizePkg.equals(stats.packageName)) {
      mCurComputingSizePkg=null;
      sendEmptyMessage(MSG_LOAD_SIZES);
    }
  }
}

Fixed version (ground truth):
public void onGetStatsCompleted(PackageStats stats,boolean succeeded){
  boolean sizeChanged=false;
synchronized (mEntriesMap) {
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
    AppEntry entry=mEntriesMap.get(stats.packageName);
    if (entry != null) {
synchronized (entry) {
        entry.sizeStale=false;
        entry.sizeLoadStart=0;
        long newSize=getTotalSize(stats);
        if (entry.size != newSize || entry.cacheSize != stats.cacheSize || entry.codeSize != stats.codeSize || entry.dataSize != stats.dataSize) {
          entry.size=newSize;
          entry.cacheSize=stats.cacheSize;
          entry.codeSize=stats.codeSize;
          entry.dataSize=stats.dataSize;
          entry.sizeStr=getSizeStr(entry.size);
          if (DEBUG)           Log.i(TAG,"String_Node_Str" + entry.label + "String_Node_Str"+ entry+ "String_Node_Str"+ entry.sizeStr);
          sizeChanged=true;
        }
      }
      if (sizeChanged) {
        Message msg=mMainHandler.obtainMessage(MainHandler.MSG_PACKAGE_SIZE_CHANGED,stats.packageName);
        mMainHandler.sendMessage(msg);
      }
    }
    if (mCurComputingSizePkg == null || mCurComputingSizePkg.equals(stats.packageName)) {
      mCurComputingSizePkg=null;
      sendEmptyMessage(MSG_LOAD_SIZES);
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
}
Program: 180796
Project: 180796
Buggy source:
void requestSize(String packageName){
synchronized (mEntriesMap) {
    AppEntry entry=mEntriesMap.get(packageName);
    if (entry != null) {
      mPm.getPackageSizeInfo(packageName,mBackgroundHandler.mStatsObserver);
    }
  }
}

Fixed version (ground truth):
void requestSize(String packageName){
  if (DEBUG_LOCKING)   Log.v(TAG,"String_Node_Str");
synchronized (mEntriesMap) {
    AppEntry entry=mEntriesMap.get(packageName);
    if (entry != null) {
      mPm.getPackageSizeInfo(packageName,mBackgroundHandler.mStatsObserver);
    }
    if (DEBUG_LOCKING)     Log.v(TAG,"String_Node_Str");
  }
}
Program: 180797
Project: 180797
Buggy source:
@Override public void onRebuildComplete(ArrayList<AppEntry> apps){
  mListContainer.setVisibility(View.VISIBLE);
  mLoadingContainer.setVisibility(View.GONE);
  mWaitingForData=false;
  mBaseEntries=apps;
  mEntries=applyPrefixFilter(mCurFilterPrefix,mBaseEntries);
  notifyDataSetChanged();
  updateStorageUsage();
}

Fixed version (ground truth):
@Override public void onRebuildComplete(ArrayList<AppEntry> apps){
  if (mLoadingContainer.getVisibility() == View.VISIBLE) {
    mLoadingContainer.startAnimation(AnimationUtils.loadAnimation(ManageApplications.this,android.R.anim.fade_out));
    mListContainer.startAnimation(AnimationUtils.loadAnimation(ManageApplications.this,android.R.anim.fade_in));
  }
  mListContainer.setVisibility(View.VISIBLE);
  mLoadingContainer.setVisibility(View.GONE);
  mWaitingForData=false;
  mBaseEntries=apps;
  mEntries=applyPrefixFilter(mCurFilterPrefix,mBaseEntries);
  notifyDataSetChanged();
  updateStorageUsage();
}
Program: 180798
Project: 180798
Buggy source:
void onBondingDockConnect(){
  mConnectAttempted=SystemClock.elapsedRealtime();
}

Fixed version (ground truth):
void onBondingDockConnect(){
  connect();
}
Program: 180799
Project: 180799
Buggy source:
void onBondingDockConnect(){
  mConnectAttempted=SystemClock.elapsedRealtime();
}

Fixed version (ground truth):
void onBondingDockConnect(){
  connect();
}
Program: 180800
Project: 180800
Buggy source:
public void disconnect(Profile profile){
  queueCommand(new BluetoothJob(BluetoothCommand.DISCONNECT,this,profile));
}

Fixed version (ground truth):
public void disconnect(Profile profile){
  disconnectInt(this,profile);
}
Program: 180801
Project: 180801
Buggy source:
public void onProfileStateChanged(Profile profile,int newProfileState){
synchronized (workQueue) {
    if (D) {
      Log.d(TAG,"String_Node_Str" + workQueue.toString());
    }
    int newState=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile).convertState(newProfileState);
    if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED) {
      if (!mProfiles.contains(profile)) {
        mProfiles.add(profile);
      }
    }
    if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED || newState == SettingsBtStatus.CONNECTION_STATUS_DISCONNECTED) {
      BluetoothJob job=workQueue.peek();
      if (job == null) {
        return;
      }
 else       if (!job.cachedDevice.mDevice.equals(mDevice)) {
        if (D) {
          Log.d(TAG,"String_Node_Str" + mDevice + "String_Node_Str"+ job.toString());
        }
        if (!pruneQueue(null)) {
          return;
        }
      }
 else {
        workQueue.poll();
      }
      processCommands();
    }
  }
}

Fixed version (ground truth):
public void onProfileStateChanged(Profile profile,int newProfileState){
  if (D) {
    Log.d(TAG,"String_Node_Str" + profile.toString() + "String_Node_Str"+ newProfileState);
  }
  int newState=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile).convertState(newProfileState);
  if (newState == SettingsBtStatus.CONNECTION_STATUS_CONNECTED) {
    if (!mProfiles.contains(profile)) {
      mProfiles.add(profile);
    }
  }
}
Program: 180802
Project: 180802
Buggy source:
public void unpair(){
  disconnect();
  int state=getBondState();
  if (state == BluetoothDevice.BOND_BONDING) {
    mDevice.cancelBondProcess();
  }
  if (state != BluetoothDevice.BOND_NONE) {
    queueCommand(new BluetoothJob(BluetoothCommand.REMOVE_BOND,this,null));
  }
}

Fixed version (ground truth):
public void unpair(){
  disconnect();
  int state=getBondState();
  if (state == BluetoothDevice.BOND_BONDING) {
    mDevice.cancelBondProcess();
  }
  if (state != BluetoothDevice.BOND_NONE) {
    final BluetoothDevice dev=getDevice();
    if (dev != null) {
      final boolean successful=dev.removeBond();
      if (successful) {
        if (D) {
          Log.d(TAG,"String_Node_Str" + describe(null));
        }
      }
 else       if (V) {
        Log.v(TAG,"String_Node_Str" + describe(null));
      }
    }
  }
}
Program: 180803
Project: 180803
Buggy source:
private void connectWithoutResettingTimer(){
  if (mProfiles.size() == 0) {
    if (!updateProfiles()) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  mIsConnectingErrorPossible=true;
  int preferredProfiles=0;
  for (  Profile profile : mProfiles) {
    if (isConnectableProfile(profile)) {
      LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
      if (profileManager.isPreferred(mDevice)) {
        ++preferredProfiles;
        disconnectConnected(profile);
        queueCommand(new BluetoothJob(BluetoothCommand.CONNECT,this,profile));
      }
    }
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + preferredProfiles);
  if (preferredProfiles == 0) {
    connectAllProfiles();
  }
}

Fixed version (ground truth):
private void connectWithoutResettingTimer(){
  if (mProfiles.size() == 0) {
    if (!updateProfiles()) {
      if (DEBUG)       Log.d(TAG,"String_Node_Str");
      return;
    }
  }
  mIsConnectingErrorPossible=true;
  int preferredProfiles=0;
  for (  Profile profile : mProfiles) {
    if (isConnectableProfile(profile)) {
      LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
      if (profileManager.isPreferred(mDevice)) {
        ++preferredProfiles;
        disconnectConnected(profile);
        connectInt(this,profile);
      }
    }
  }
  if (DEBUG)   Log.d(TAG,"String_Node_Str" + preferredProfiles);
  if (preferredProfiles == 0) {
    connectAllProfiles();
  }
}
Program: 180804
Project: 180804
Buggy source:
private boolean disconnectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.disconnect(cachedDevice.mDevice)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean disconnectInt(CachedBluetoothDevice cachedDevice,Profile profile){
  LocalBluetoothProfileManager profileManager=LocalBluetoothProfileManager.getProfileManager(mLocalManager,profile);
  int status=profileManager.getConnectionStatus(cachedDevice.mDevice);
  if (SettingsBtStatus.isConnectionStatusConnected(status)) {
    if (profileManager.disconnect(cachedDevice.mDevice)) {
      if (D) {
        Log.d(TAG,"String_Node_Str" + describe(profile));
      }
      return true;
    }
    if (V) {
      Log.v(TAG,"String_Node_Str" + describe(profile));
    }
  }
  return false;
}