nus-yam/ex-repair huggingface dataset:
Program: 166815
Project: 166815
Buggy source:
/** 
 * Deep clone an array list of terms
 * @param original The original component list
 * @return an identical and separate copy of the list
 */
public static ArrayList<Term> cloneList(final ArrayList<Term> original){
  if (original == null) {
    return null;
  }
  final int osize=original.size();
  final ArrayList<Term> arr=new ArrayList(osize);
  for (int i=0; i < osize; i++) {
    Term original1=original.get(i);
    arr.add((Term)(original1.clone()));
  }
  return arr;
}

Fixed version (ground truth):
/** 
 * Deep clone an array list of terms
 * @param original The original component list
 * @return an identical and separate copy of the list
 */
public static ArrayList<Term> cloneList(final List<Term> original){
  if (original == null) {
    return null;
  }
  final int osize=original.size();
  final ArrayList<Term> arr=new ArrayList(osize);
  for (int i=0; i < osize; i++) {
    Term original1=original.get(i);
    arr.add((Term)(original1.clone()));
  }
  return arr;
}
Program: 166816
Project: 166816
Buggy source:
/** 
 * default method to make the oldName of an image term from given fields
 * @param op the term operator
 * @param arg the list of components
 * @param relationIndex the location of the place holder
 * @return the oldName of the term
 */
protected static String makeImageName(final Operator op,final ArrayList<Term> arg,final int relationIndex){
  StringBuilder name=new StringBuilder(16).append(Symbols.COMPOUND_TERM_OPENER).append(op).append(Symbols.ARGUMENT_SEPARATOR).append(arg.get(relationIndex).getName());
  for (int i=0; i < arg.size(); i++) {
    name.append(Symbols.ARGUMENT_SEPARATOR);
    if (i == relationIndex) {
      name.append(Symbols.IMAGE_PLACE_HOLDER);
    }
 else {
      name.append(arg.get(i).getName());
    }
  }
  name.append(Symbols.COMPOUND_TERM_CLOSER);
  return name.toString();
}

Fixed version (ground truth):
/** 
 * default method to make the oldName of an image term from given fields
 * @param op the term operator
 * @param arg the list of components
 * @param relationIndex the location of the place holder
 * @return the oldName of the term
 */
protected static String makeImageName(final Operator op,final List<Term> arg,final int relationIndex){
  StringBuilder name=new StringBuilder(16).append(Symbols.COMPOUND_TERM_OPENER).append(op).append(Symbols.ARGUMENT_SEPARATOR).append(arg.get(relationIndex).getName());
  for (int i=0; i < arg.size(); i++) {
    name.append(Symbols.ARGUMENT_SEPARATOR);
    if (i == relationIndex) {
      name.append(Symbols.IMAGE_PLACE_HOLDER);
    }
 else {
      name.append(arg.get(i).getName());
    }
  }
  name.append(Symbols.COMPOUND_TERM_CLOSER);
  return name.toString();
}
Program: 166817
Project: 166817
Buggy source:
/** 
 * Constructor with full values, called by clone
 * @param n The name of the term
 * @param cs Component list
 * @param con Whether the term is a constant
 * @param i Syntactic complexity of the compound
 */
private Conjunction(String n,ArrayList<Term> cs,boolean con,short i,int order){
  super(n,cs,con,i);
  temporalOrder=order;
}

Fixed version (ground truth):
/** 
 * Constructor with full values, called by clone
 * @param n The name of the term
 * @param cs Component list
 * @param con Whether the term is a constant
 * @param i Syntactic complexity of the compound
 */
private Conjunction(String n,ArrayList<Term> arg,boolean con,short i,int order){
  super(n,arg,con,i);
  temporalOrder=order;
}
Program: 166818
Project: 166818
Buggy source:
/** 
 * Constructor with full values, called by clone
 * @param n The name of the term
 * @param cs Component list
 * @param open Open variable list
 * @param i Syntactic complexity of the compound
 */
private Disjunction(String n,ArrayList<Term> cs,boolean con,short i){
  super(n,cs,con,i);
}

Fixed version (ground truth):
/** 
 * Constructor with full values, called by clone
 * @param n The name of the term
 * @param cs Component list
 * @param open Open variable list
 * @param i Syntactic complexity of the compound
 */
private Disjunction(String n,ArrayList<Term> arg,boolean con,short i){
  super(n,arg,con,i);
  if (arg.size() < 2) {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 166819
Project: 166819
Buggy source:
public DefaultNARBuilder(){
  super();
  setConceptBagSize(1000);
  setBagLevels(100);
}

Fixed version (ground truth):
public DefaultNARBuilder(){
  super();
  setConceptBagLevels(DefaultLevels);
  setConceptBagSize(1000);
  setTaskLinkBagLevels(DefaultLevels);
  setTaskLinkBagSize(20);
  setTermLinkBagLevels(DefaultLevels);
  setTermLinkBagSize(100);
}
Program: 166820
Project: 166820
Buggy source:
/** 
 * Constructor, called in Memory.getConcept only
 * @param tm A term corresponding to the concept
 * @param memory A reference to the memory
 */
public Concept(final Term tm,final Memory memory){
  super(tm.getName());
  term=tm;
  this.memory=memory;
  questions=new LinkedList();
  beliefs=new ArrayList<>();
  taskLinks=new TaskLinkBag(memory.nar.config.getBagLevels(),Parameters.TASK_LINK_BAG_SIZE,memory.taskForgettingRate);
  termLinks=new TermLinkBag(memory.nar.config.getBagLevels(),Parameters.TERM_LINK_BAG_SIZE,memory.beliefForgettingRate);
  if (tm instanceof CompoundTerm) {
    termLinkTemplates=((CompoundTerm)tm).prepareComponentLinks();
  }
}

Fixed version (ground truth):
/** 
 * Constructor, called in Memory.getConcept only
 * @param tm A term corresponding to the concept
 * @param memory A reference to the memory
 */
public Concept(final Term tm,final Memory memory){
  super(tm.getName());
  term=tm;
  this.memory=memory;
  questions=new LinkedList();
  beliefs=new ArrayList<>();
  taskLinks=new TaskLinkBag(memory.nar.config.getTaskLinkBagLevels(),memory.nar.config.getTaskLinkBagSize(),memory.taskForgettingRate);
  termLinks=new TermLinkBag(memory.nar.config.getTermLinkBagLevels(),memory.nar.config.getTermLinkBagSize(),memory.beliefForgettingRate);
  if (tm instanceof CompoundTerm) {
    termLinkTemplates=((CompoundTerm)tm).prepareComponentLinks();
  }
}
Program: 166821
Project: 166821
Buggy source:
/** 
 * Add element to the chain
 * @return The evidentialBase of numbers
 */
public void addToChain(final Term T){
  derivationChain.add(T);
  if (derivationChain.size() > Parameters.MAXIMUM_DERIVATION_CHAIN_LENGTH) {
    derivationChain.remove(0);
  }
}

Fixed version (ground truth):
/** 
 * Add element to the chain.
 * @return The evidentialBase of numbers
 */
public void addToChain(final Term T,Sentence owner){
  derivationChain.add(T);
  if (derivationChain.size() > Parameters.MAXIMUM_DERIVATION_CHAIN_LENGTH) {
    derivationChain.remove(0);
  }
  owner.setStamp(this);
}
Program: 166822
Project: 166822
Buggy source:
/** 
 * Check if a Sentence provide a better answer to a Question or Goal
 * @param belief The proposed answer
 * @param task The task to be processed
 * @param memory Reference to the memory
 */
public static void trySolution(Sentence belief,Task task,Memory memory){
  Sentence problem=task.getSentence();
  Sentence oldBest=task.getBestSolution();
  float newQ=solutionQuality(problem,belief);
  if (oldBest != null) {
    float oldQ=solutionQuality(problem,oldBest);
    if (oldQ >= newQ) {
      return;
    }
  }
  Term content=belief.cloneContent();
  if (Variable.containVarIndep(content.getName())) {
    Variable.unify(Symbols.VAR_INDEPENDENT,content,problem.cloneContent());
    belief=(Sentence)belief.clone();
    belief.setContent(content);
    Stamp st=new Stamp(belief.getStamp(),memory.getTime());
    st.addToChain(belief.getContent());
    belief.setStamp(st);
  }
  task.setBestSolution(belief);
  if (task.isInput()) {
    memory.nar.output(OUT.class,belief);
  }
  BudgetValue budget=BudgetFunctions.solutionEval(problem,belief,task,memory);
  if ((budget != null) && budget.aboveThreshold()) {
    memory.activatedTask(budget,belief,task.getParentBelief());
  }
}

Fixed version (ground truth):
/** 
 * Check if a Sentence provide a better answer to a Question or Goal
 * @param belief The proposed answer
 * @param task The task to be processed
 * @param memory Reference to the memory
 */
public static void trySolution(Sentence belief,Task task,Memory memory){
  Sentence problem=task.getSentence();
  Sentence oldBest=task.getBestSolution();
  float newQ=solutionQuality(problem,belief);
  if (oldBest != null) {
    float oldQ=solutionQuality(problem,oldBest);
    if (oldQ >= newQ) {
      return;
    }
  }
  Term content=belief.cloneContent();
  if (Variable.containVarIndep(content.getName())) {
    Variable.unify(Symbols.VAR_INDEPENDENT,content,problem.cloneContent());
    belief=(Sentence)belief.clone();
    belief.setContent(content);
    Stamp st=new Stamp(belief.getStamp(),memory.getTime());
    st.addToChain(belief.getContent(),belief);
  }
  task.setBestSolution(belief);
  if (task.isInput()) {
    memory.nar.output(OUT.class,belief);
  }
  BudgetValue budget=BudgetFunctions.solutionEval(problem,belief,task,memory);
  if ((budget != null) && budget.aboveThreshold()) {
    memory.activatedTask(budget,belief,task.getParentBelief());
  }
}
Program: 166823
Project: 166823
Buggy source:
public static void main(String[] args) throws Exception {
  NAR n=new DefaultNARBuilder().setConceptBagSize(8192).build();
  new TextOutput(n,System.out);
  n.start(0);
  new XMLInput(n,"String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  NAR n=new DefaultNARBuilder().setConceptBagSize(8192).setTermLinkBagLevels(8).setTaskLinkBagLevels(8).build();
  n.start(0);
  new XMLInput(n,"String_Node_Str","String_Node_Str");
}
Program: 166824
Project: 166824
Buggy source:
/** 
 * Recursively apply a substitute to the current CompoundTerm
 * @param subs
 */
public void applySubstitute(HashMap<Term,Term> subs){
  for (int i=0; i < size(); i++) {
    final Term t1=componentAt(i);
    if (subs.containsKey(t1)) {
      Term t2=subs.get(t1);
      while (subs.containsKey(t2)) {
        t2=subs.get(t2);
      }
      components.set(i,(Term)t2.clone());
    }
 else     if (t1 instanceof CompoundTerm) {
      ((CompoundTerm)t1).applySubstitute(subs);
    }
  }
  if (this.isCommutative()) {
    components=new ArrayList<>(new TreeSet<>(components));
  }
  name=makeName();
}

Fixed version (ground truth):
/** 
 * Recursively apply a substitute to the current CompoundTerm
 * @param subs
 */
public void applySubstitute(final HashMap<Term,Term> subs){
  int i=0;
  for (  final Term t1 : components) {
    Term t2=subs.get(t1);
    if (t2 != null) {
      while (subs.containsKey(t2)) {
        t2=subs.get(t2);
      }
      components.set(i,(Term)t2.clone());
    }
 else     if (t1 instanceof CompoundTerm) {
      ((CompoundTerm)t1).applySubstitute(subs);
    }
    i++;
  }
  if (this.isCommutative()) {
    components=new ArrayList<>(new TreeSet<>(components));
  }
  name=makeName();
}
Program: 166825
Project: 166825
Buggy source:
@Override public int hashCode(){
  int hash=7;
  hash=43 * hash + Objects.hashCode(this.components);
  return hash;
}

Fixed version (ground truth):
@Override public int hashCode(){
  int hash=7;
  hash=43 * hash + Objects.hashCode(this.components);
  hash=43 * hash + operator().hashCode();
  return hash;
}
Program: 166826
Project: 166826
Buggy source:
/** 
 * Recursively rename the variables in the compound
 * @param map The substitution established so far
 */
private void renameVariables(final HashMap<Variable,Variable> map){
  if (containVar()) {
    for (int i=0; i < components.size(); i++) {
      final Term term=componentAt(i);
      if (term instanceof Variable) {
        Variable var;
        if (term.getName().length() == 1) {
          var=new Variable(term.getName().charAt(0) + "String_Node_Str" + (map.size() + 1));
        }
 else {
          var=(Variable)map.get((Variable)term);
          if (var == null) {
            var=new Variable(term.getName().charAt(0) + "String_Node_Str" + (map.size() + 1));
          }
        }
        if (!term.equals(var)) {
          components.set(i,var);
        }
        map.put((Variable)term,var);
      }
 else       if (term instanceof CompoundTerm) {
        ((CompoundTerm)term).renameVariables(map);
        ((CompoundTerm)term).setName(((CompoundTerm)term).makeName());
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Recursively rename the variables in the compound
 * @param map The substitution established so far
 */
private void renameVariables(final HashMap<Variable,Variable> map){
  if (containVar()) {
    int i=0;
    for (    final Term term : components) {
      if (term instanceof Variable) {
        Variable var;
        if (term.getName().length() == 1) {
          var=new Variable(term.getName().charAt(0) + String.valueOf(map.size() + 1));
        }
 else {
          var=(Variable)map.get((Variable)term);
          if (var == null) {
            var=new Variable(term.getName().charAt(0) + String.valueOf(map.size() + 1));
          }
        }
        if (!term.equals(var)) {
          components.set(i,var);
        }
        map.put((Variable)term,var);
      }
 else       if (term instanceof CompoundTerm) {
        CompoundTerm ct=(CompoundTerm)term;
        ct.renameVariables(map);
        ct.setName(ct.makeName());
      }
      i++;
    }
  }
}
Program: 166827
Project: 166827
Buggy source:
/** 
 * Create a new memory <p> Called in Reasoner.reset only
 * @param nar
 */
public Memory(NAR nar){
  this.nar=nar;
  recorder=NullInferenceRecorder.global;
  concepts=new ConceptBag(nar.config.getBagLevels(),nar.config.getConceptBagSize(),conceptForgettingRate);
  novelTasks=new NovelTaskBag(nar.config.getBagLevels(),Parameters.TASK_BUFFER_SIZE);
  newTasks=new LinkedList<>();
}

Fixed version (ground truth):
/** 
 * Create a new memory <p> Called in Reasoner.reset only
 * @param nar
 */
public Memory(NAR nar){
  this.nar=nar;
  recorder=NullInferenceRecorder.global;
  concepts=new ConceptBag(nar.config.getConceptBagLevels(),nar.config.getConceptBagSize(),conceptForgettingRate);
  novelTasks=new NovelTaskBag(nar.config.getConceptBagLevels(),Parameters.TASK_BUFFER_SIZE);
  newTasks=new LinkedList<>();
}
Program: 166829
Project: 166829
Buggy source:
public static void main(String[] args) throws Exception {
  NAR n=new DefaultNARBuilder().setConceptBagSize(2048).setBagLevels(512).build();
  n.param.setSilenceLevel(99);
  KIFInput k=new KIFInput(n,"String_Node_Str");
  k.setIncludeSubclass(true);
  k.start();
  TextOutput t=new TextOutput(n,System.out);
  t.setErrors(true);
  t.setErrorStackTrace(true);
  n.finish(16);
  new NARSwing(n);
  System.err.println(new NARState(n).measure());
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  NAR n=new DefaultNARBuilder().setConceptBagSize(2048).setConceptBagLevels(512).build();
  n.param.setSilenceLevel(99);
  KIFInput k=new KIFInput(n,"String_Node_Str");
  k.setIncludeSubclass(true);
  k.start();
  TextOutput t=new TextOutput(n,System.out);
  t.setErrors(true);
  t.setErrorStackTrace(true);
  n.finish(16);
  new NARSwing(n);
  System.err.println(new NARState(n).measure());
}
Program: 166831
Project: 166831
Buggy source:
/** 
 * Try to make a new compound from two components. Called by the inference rules.
 * @param subject The first compoment
 * @param predicate The second compoment
 * @param memory Reference to the memory
 * @return A compound generated or null
 */
public static Inheritance make(Term subject,Term predicate,Memory memory){
  if (invalidStatement(subject,predicate)) {
    throw new RuntimeException("String_Node_Str" + subject + "String_Node_Str"+ predicate);
  }
  String name=makeStatementName(subject,Relation.INHERITANCE.toString(),predicate);
  Term t=memory.nameToListedTerm(name);
  if (t != null) {
    return (Inheritance)t;
  }
  ArrayList<Term> argument=argumentsToList(subject,predicate);
  return new Inheritance(argument);
}

Fixed version (ground truth):
/** 
 * Try to make a new compound from two components. Called by the inference rules.
 * @param subject The first compoment
 * @param predicate The second compoment
 * @param memory Reference to the memory
 * @return A compound generated or null
 */
public static Inheritance make(Term subject,Term predicate,Memory memory){
  if (invalidStatement(subject,predicate)) {
    return null;
  }
  String name=makeStatementName(subject,Relation.INHERITANCE.toString(),predicate);
  Term t=memory.nameToListedTerm(name);
  if (t != null) {
    return (Inheritance)t;
  }
  ArrayList<Term> argument=argumentsToList(subject,predicate);
  return new Inheritance(argument);
}
Program: 166832
Project: 166832
Buggy source:
@Override public void write(CastExpression castExpression){
  Expression expression=castExpression.getExpression();
  Type type=castExpression.getType();
  if (isGenericArrayCreation(castExpression))   writeGenericArrayCreation((ArrayType)type,(ArrayCreation)expression);
 else {
    matchAndWrite("String_Node_Str");
    copySpaceAndComments();
    writeNode(type);
    copySpaceAndComments();
    matchAndWrite("String_Node_Str");
    copySpaceAndComments();
    writeNode(expression);
  }
}

Fixed version (ground truth):
@Override public void write(CastExpression castExpression){
  Expression expression=castExpression.getExpression();
  Type type=castExpression.getType();
  if (isGenericArrayCreation(castExpression))   writeGenericArrayCreation((ArrayType)type,(ArrayCreation)expression);
 else {
    boolean makeUncheckedCast=isNumericPrimitiveType(type) && expression instanceof NumberLiteral;
    if (makeUncheckedCast)     write("String_Node_Str");
    matchAndWrite("String_Node_Str");
    copySpaceAndComments();
    writeNode(type);
    copySpaceAndComments();
    matchAndWrite("String_Node_Str");
    copySpaceAndComments();
    writeNode(expression);
    if (makeUncheckedCast)     write("String_Node_Str");
  }
}
Program: 166835
Project: 166835
Buggy source:
public <TElmt>void writeNodes(List list,ASTUtil.IProcessListElmt<TElmt> processList){
  boolean first=true;
  for (  Object elmtObject : list) {
    TElmt elmt=(TElmt)elmtObject;
    processList.process(elmt);
  }
}

Fixed version (ground truth):
public <TElmt>void writeNodes(List list,Consumer<TElmt> consumer){
  boolean first=true;
  for (  Object elmtObject : list) {
    TElmt elmt=(TElmt)elmtObject;
    consumer.accept(elmt);
  }
}
Program: 166836
Project: 166836
Buggy source:
public static boolean isFunctionalInterfaceImplementation(SourceFileWriter sourceFileWriter,Type type){
  ITypeBinding typeBinding=sourceFileWriter.resolveTypeBinding(type);
  if (!typeBinding.isInterface())   return false;
  int methodCount=typeBinding.getDeclaredMethods().length;
  if (methodCount != 1)   return false;
  boolean hasFunctionalInterfaceAnnotation=false;
  typeBinding.getAnnotations();
  for (  IAnnotationBinding annotationBinding : typeBinding.getAnnotations()) {
    annotationBinding.getAnnotationType().getQualifiedName().equals("String_Node_Str");
    hasFunctionalInterfaceAnnotation=true;
  }
  if (!hasFunctionalInterfaceAnnotation)   return false;
  return true;
}

Fixed version (ground truth):
public static boolean isFunctionalInterfaceImplementation(SourceFileWriter sourceFileWriter,Type type){
  ITypeBinding typeBinding=sourceFileWriter.resolveTypeBinding(type);
  if (!typeBinding.isInterface())   return false;
  int methodCount=typeBinding.getDeclaredMethods().length;
  if (methodCount != 1)   return false;
  boolean hasFunctionalInterfaceAnnotation=false;
  for (  IAnnotationBinding annotationBinding : typeBinding.getAnnotations()) {
    annotationBinding.getAnnotationType().getQualifiedName().equals("String_Node_Str");
    hasFunctionalInterfaceAnnotation=true;
  }
  if (!hasFunctionalInterfaceAnnotation)   return false;
  return true;
}
Program: 166837
Project: 166837
Buggy source:
public static <T>void forEach(List list,IProcessListElmtWithFirst<T> listDo){
  boolean first=true;
  for (  Object elmtObject : list) {
    T elmt=(T)elmtObject;
    listDo.process(elmt,first);
    first=false;
  }
}

Fixed version (ground truth):
public static <T>boolean forEach(List list,ConsumerWithFirst<T> consumerWithFirst){
  boolean first=true;
  for (  Object elmtObject : list) {
    T elmt=(T)elmtObject;
    consumerWithFirst.accept(elmt,first);
    first=false;
  }
  return !first;
}
Program: 166838
Project: 166838
Buggy source:
/** 
 * Add all the wildcards referenced from a given type, searching recursively in the type definition to add all of them.   That is, for a type like this: <p> "Foo< Bar<? extends Fizz>, <Blip <? super Pop>>, ? >" <p> 3 wildcard types would be added (<? extends Fizz>, <? super Pop>, and ?) since essentially the ? appears 3 times the in the type definition above.
 * @param type
 * @param wildcardTypes
 */
public static void addWildcardTypes(Type type,ArrayList<WildcardType> wildcardTypes){
  if (type.isParameterizedType()) {
    ParameterizedType parameterizedType=(ParameterizedType)type;
    for (    Object typeArgumentObject : parameterizedType.typeArguments()) {
      Type typeArgument=(Type)typeArgumentObject;
      addWildcardTypes(typeArgument,wildcardTypes);
    }
  }
 else   if (type.isWildcardType()) {
    WildcardType wildcardType=(WildcardType)type;
    wildcardTypes.add(wildcardType);
    @Nullable Type bound=wildcardType.getBound();
    if (bound != null)     addWildcardTypes(bound,wildcardTypes);
  }
}

Fixed version (ground truth):
/** 
 * Add all the wildcards referenced from a given type, searching recursively in the type definition to add all of them.   That is, for a type like this: <p> "Foo< Bar<? extends Fizz>, <Blip <? super Pop>>, ? >" <p> 3 wildcard types would be added (<? extends Fizz>, <? super Pop>, and ?) since essentially the ? appears 3 times the in the type definition above.
 * @param type
 * @param wildcardTypes
 */
public static void addWildcardTypes(Type type,ArrayList<WildcardType> wildcardTypes){
  if (type.isParameterizedType()) {
    ParameterizedType parameterizedType=(ParameterizedType)type;
    forEach(parameterizedType.typeArguments(),(    Type typeArgument) -> {
      addWildcardTypes(typeArgument,wildcardTypes);
    }
);
  }
 else   if (type.isWildcardType()) {
    WildcardType wildcardType=(WildcardType)type;
    wildcardTypes.add(wildcardType);
    @Nullable Type bound=wildcardType.getBound();
    if (bound != null)     addWildcardTypes(bound,wildcardTypes);
  }
}
Program: 166839
Project: 166839
Buggy source:
public void setTypeDeclaration(TypeDeclaration typeDeclaration){
  this.typeDeclaration=typeDeclaration;
}

Fixed version (ground truth):
public void setTypeDeclaration(TypeDeclaration typeDeclaration){
  if (typeDeclaration != this.typeDeclaration) {
    this.typeDeclaration=typeDeclaration;
    this.typeMethodNames=null;
  }
}
Program: 166842
Project: 166842
Buggy source:
private void writeUsingStatements(CompilationUnit compilationUnit){
  forEach(compilationUnit.imports(),(  ImportDeclaration importDeclaration) -> {
    Name importDeclarationName=importDeclaration.getName();
    if (isThisName(importDeclarationName,"String_Node_Str")) {
      setPositionToEndOfNode(importDeclaration);
      return;
    }
    if (importDeclaration.isStatic())     throw sourceNotSupported("String_Node_Str");
    copySpaceAndComments();
    matchAndWrite("String_Node_Str","String_Node_Str");
    if (importDeclaration.isOnDemand()) {
      copySpaceAndComments();
      writeNode(importDeclarationName);
    }
 else {
      if (!(importDeclarationName instanceof QualifiedName))       throw sourceNotSupported("String_Node_Str");
      QualifiedName qualifiedName=(QualifiedName)importDeclarationName;
      copySpaceAndComments();
      writeNodeAtDifferentPosition(qualifiedName.getName());
      write("String_Node_Str");
      writeNode(qualifiedName);
    }
    copySpaceAndComments();
    matchAndWrite("String_Node_Str");
  }
);
  for (  String extraUsing : getContext().getExtraUsings()) {
    write("String_Node_Str");
    write(extraUsing);
    writeln("String_Node_Str");
  }
}

Fixed version (ground truth):
private void writeUsingStatements(CompilationUnit compilationUnit){
  Set<String> genericUsings=new HashSet<>();
  Var<Boolean> wroteUsing=new Var<>(false);
  forEach(compilationUnit.imports(),(  ImportDeclaration importDeclaration) -> {
    Name importDeclarationName=importDeclaration.getName();
    if (isThisName(importDeclarationName,"String_Node_Str")) {
      setPositionToEndOfNode(importDeclaration);
      return;
    }
    if (importDeclaration.isStatic())     throw sourceNotSupported("String_Node_Str");
    if (!(importDeclarationName instanceof QualifiedName))     throw sourceNotSupported("String_Node_Str");
    QualifiedName qualifiedName=(QualifiedName)importDeclarationName;
    @Nullable String namespaceToImportForGenericClass=null;
    if (isGenericImport(importDeclaration)) {
      namespaceToImportForGenericClass=qualifiedName.getQualifier().getFullyQualifiedName();
      if (genericUsings.contains(namespaceToImportForGenericClass))       return;
    }
    copySpaceAndComments();
    matchAndWrite("String_Node_Str","String_Node_Str");
    copySpaceAndComments();
    if (importDeclaration.isOnDemand()) {
      writeNode(importDeclarationName);
    }
 else {
      if (namespaceToImportForGenericClass != null) {
        write(namespaceToImportForGenericClass);
        genericUsings.add(namespaceToImportForGenericClass);
        setPositionToEndOfNode(qualifiedName);
      }
 else {
        writeNodeAtDifferentPosition(qualifiedName.getName());
        write("String_Node_Str");
        writeNode(qualifiedName);
      }
    }
    copySpaceAndComments();
    matchAndWrite("String_Node_Str");
    wroteUsing.set(true);
  }
);
  if (wroteUsing.get())   writeln();
  for (  String extraUsing : getContext().getExtraUsings()) {
    write("String_Node_Str");
    write(extraUsing);
    writeln("String_Node_Str");
  }
}
Program: 166843
Project: 166843
Buggy source:
public static boolean isPrivate(MethodDeclaration methodDeclaration){
  return getAccessModifier(methodDeclaration.modifiers()) == AccessLevel.PRIVATE;
}

Fixed version (ground truth):
public static boolean isPrivate(BodyDeclaration bodyDeclaration){
  return getAccessModifier(bodyDeclaration.modifiers()) == AccessLevel.PRIVATE;
}
Program: 166844
Project: 166844
Buggy source:
public static boolean isFinal(MethodDeclaration methodDeclaration){
  return containsFinal(methodDeclaration.modifiers());
}

Fixed version (ground truth):
public static boolean isFinal(BodyDeclaration bodyDeclaration){
  return containsFinal(bodyDeclaration.modifiers());
}
Program: 166847
Project: 166847
Buggy source:
@Override public void write(FieldDeclaration fieldDeclaration){
  List<?> modifiers=fieldDeclaration.modifiers();
  boolean[] wroteModifier=new boolean[1];
  writeAccessModifier(modifiers);
  skipModifiers(modifiers);
  skipSpaceAndComments();
  if (wroteModifier[0])   write("String_Node_Str");
  writeNode(fieldDeclaration.getType());
  writeCommaDelimitedNodes(fieldDeclaration.fragments());
  copySpaceAndComments();
  matchAndWrite("String_Node_Str");
}

Fixed version (ground truth):
@Override public void write(FieldDeclaration fieldDeclaration){
  boolean isFinal=isFinal(fieldDeclaration);
  boolean isStatic=isStatic(fieldDeclaration);
  List<?> modifiers=fieldDeclaration.modifiers();
  writeAccessModifier(modifiers);
  if (isStatic)   writeStaticModifier();
  if (isFinal)   writeReadonlyModifier();
  skipModifiers(modifiers);
  skipSpaceAndComments();
  writeNode(fieldDeclaration.getType());
  writeCommaDelimitedNodes(fieldDeclaration.fragments());
  copySpaceAndComments();
  matchAndWrite("String_Node_Str");
}
Program: 166849
Project: 166849
Buggy source:
public boolean isLookingAtObject(Object3D target,float maxAngle){
  Quaternion o=getCurrentCamera().getOrientation().invertAndCreate();
  Vector3 forward=new Vector3(0,0,1);
  forward.transform(o);
  Vector3 pos=getCurrentCamera().getPosition().clone();
  pos.subtract(target.getPosition());
  pos.normalize();
  return pos.angle(forward) < maxAngle;
}

Fixed version (ground truth):
public boolean isLookingAtObject(Object3D target,float maxAngle){
  mHeadViewQuaternion.fromMatrix(mHeadViewMatrix);
  mHeadViewQuaternion.inverse();
  mForwardVec.setAll(0,0,1);
  mForwardVec.transform(mHeadViewQuaternion);
  mHeadTranslation.setAll(mHeadViewMatrix.getTranslation());
  mHeadTranslation.subtract(target.getPosition());
  mHeadTranslation.normalize();
  return mHeadTranslation.angle(mForwardVec) < maxAngle;
}
Program: 166850
Project: 166850
Buggy source:
@Override public void onDrawEye(Eye eye){
  getCurrentCamera().updatePerspective(eye.getFov().getLeft(),eye.getFov().getRight(),eye.getFov().getBottom(),eye.getFov().getTop());
  mCurrentEyeMatrix.setAll(eye.getEyeView());
  mCurrentEyeOrientation.fromMatrix(mCurrentEyeMatrix);
  getCurrentCamera().setOrientation(mCurrentEyeOrientation);
  getCurrentCamera().setPosition(mCameraPosition);
  getCurrentCamera().getPosition().add(mCurrentEyeMatrix.getTranslation());
  super.onRenderFrame(null);
}

Fixed version (ground truth):
@Override public void onDrawEye(Eye eye){
  getCurrentCamera().updatePerspective(eye.getFov().getLeft(),eye.getFov().getRight(),eye.getFov().getBottom(),eye.getFov().getTop());
  mCurrentEyeMatrix.setAll(eye.getEyeView());
  mCurrentEyeOrientation.fromMatrix(mCurrentEyeMatrix);
  getCurrentCamera().setOrientation(mCurrentEyeOrientation);
  getCurrentCamera().setPosition(mCameraPosition);
  getCurrentCamera().getPosition().add(mCurrentEyeMatrix.getTranslation().inverse());
  super.onRenderFrame(null);
}
Program: 166851
Project: 166851
Buggy source:
public RajawaliVRRenderer(Context context){
  super(context);
  mCurrentEyeMatrix=new Matrix4();
  mHeadViewMatrix=new Matrix4();
  mLookingAtMatrix=new Matrix4();
  mCurrentEyeOrientation=new Quaternion();
  mHeadView=new float[16];
  mCameraPosition=new Vector3();
}

Fixed version (ground truth):
public RajawaliVRRenderer(Context context){
  super(context);
  mCurrentEyeMatrix=new Matrix4();
  mHeadViewMatrix=new Matrix4();
  mLookingAtMatrix=new Matrix4();
  mCurrentEyeOrientation=new Quaternion();
  mHeadViewQuaternion=new Quaternion();
  mHeadView=new float[16];
  mCameraPosition=new Vector3();
  mForwardVec=new Vector3();
  mHeadTranslation=new Vector3();
}
Program: 166852
Project: 166852
Buggy source:
@Override public void onNewFrame(HeadTransform headTransform){
  headTransform.getHeadView(mHeadView,0);
}

Fixed version (ground truth):
@Override public void onNewFrame(HeadTransform headTransform){
  headTransform.getHeadView(mHeadView,0);
  mHeadViewMatrix.setAll(mHeadView);
}
Program: 166853
Project: 166853
Buggy source:
public void testParseFromIntentExtras(){
  Track track=TestTrackFactory.newTrackWithRandomData();
  Intent intent=new Intent();
  intent.putExtra(CommonMusicAppReceiver.EXTRA_PLAYER_PACKAGE_NAME,track.getPlayerPackageName());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_TRACK,track.getTrack());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_ARTIST,track.getArtist());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_ALBUM,track.getAlbum());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_DURATION,track.getDurationInMillis());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_TIMESTAMP,track.getTimestamp());
  Track parsedTrack=CommonMusicAppReceiver.parseFromIntentExtras(intent);
  assertEquals(track.getPlayerPackageName(),parsedTrack.getPlayerPackageName());
  assertEquals(track.getTrack(),parsedTrack.getTrack());
  assertEquals(track.getArtist(),parsedTrack.getArtist());
  assertEquals(track.getAlbum(),parsedTrack.getAlbum());
  assertEquals(track.getDurationInMillis(),parsedTrack.getDurationInMillis());
  assertEquals(track.getTimestamp(),parsedTrack.getTimestamp());
}

Fixed version (ground truth):
public void testParseFromIntentExtras(){
  Track track=TestTrackFactory.newTrackWithRandomData();
  Intent intent=new Intent();
  intent.putExtra(CommonMusicAppReceiver.EXTRA_PLAYER_PACKAGE_NAME,track.getPlayerPackageName());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_TRACK,track.getTrack());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_ARTIST,track.getArtist());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_ALBUM,track.getAlbum());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_DURATION,track.getDuration());
  intent.putExtra(CommonMusicAppReceiver.EXTRA_TIMESTAMP,track.getTimestamp());
  Track parsedTrack=CommonMusicAppReceiver.parseFromIntentExtras(intent);
  assertEquals(track.getPlayerPackageName(),parsedTrack.getPlayerPackageName());
  assertEquals(track.getTrack(),parsedTrack.getTrack());
  assertEquals(track.getArtist(),parsedTrack.getArtist());
  assertEquals(track.getAlbum(),parsedTrack.getAlbum());
  assertEquals(track.getDuration(),parsedTrack.getDuration());
  assertEquals(track.getTimestamp(),parsedTrack.getTimestamp());
}
Program: 166854
Project: 166854
Buggy source:
public LFTrackRequestModel(com.artemzin.android.wail.storage.model.Track trackModel){
  artist=trackModel.getArtist();
  track=trackModel.getTrack();
  timeStamp=trackModel.getTimestamp() / 1000;
  album=trackModel.getAlbum();
  duration=(int)(trackModel.getDurationInMillis() / 1000);
}

Fixed version (ground truth):
public LFTrackRequestModel(com.artemzin.android.wail.storage.model.Track trackModel){
  artist=trackModel.getArtist();
  track=trackModel.getTrack();
  timeStamp=trackModel.getTimestamp() / 1000;
  album=trackModel.getAlbum();
  duration=(int)(trackModel.getDuration() / 1000);
}
Program: 166856
Project: 166856
Buggy source:
public String toJSON(){
  final JSONObject json=new JSONObject();
  try {
    json.put("String_Node_Str",track.getPlayerPackageName());
    json.put("String_Node_Str",track.getTrack());
    json.put("String_Node_Str",track.getArtist());
    json.put("String_Node_Str",track.getAlbum());
    json.put("String_Node_Str",track.getDurationInMillis());
    json.put("String_Node_Str",track.getTimestamp());
    json.put("String_Node_Str",track.getState());
    json.put("String_Node_Str",track.getStateTimestamp());
    json.put("String_Node_Str",isPlaying);
  }
 catch (  Exception e) {
    return null;
  }
  return json.toString();
}

Fixed version (ground truth):
public String toJSON(){
  final JSONObject json=new JSONObject();
  try {
    json.put("String_Node_Str",track.getPlayerPackageName());
    json.put("String_Node_Str",track.getTrack());
    json.put("String_Node_Str",track.getArtist());
    json.put("String_Node_Str",track.getAlbum());
    json.put("String_Node_Str",track.getDuration());
    json.put("String_Node_Str",track.getTimestamp());
    json.put("String_Node_Str",track.getState());
    json.put("String_Node_Str",track.getStateTimestamp());
    json.put("String_Node_Str",isPlaying);
  }
 catch (  Exception e) {
    return null;
  }
  return json.toString();
}
Program: 166857
Project: 166857
Buggy source:
public static ContentValues asContentValues(Track track){
  final ContentValues contentValues=new ContentValues();
  contentValues.put(TableInfo.COLUMN_PLAYER_PACKAGE_NAME,track.getPlayerPackageName());
  contentValues.put(TableInfo.COLUMN_TRACK,track.getTrack());
  contentValues.put(TableInfo.COLUMN_ARTIST,track.getArtist());
  contentValues.put(TableInfo.COLUMN_ALBUM,track.getAlbum());
  contentValues.put(TableInfo.COLUMN_DURATION,track.getDurationInMillis());
  contentValues.put(TableInfo.COLUMN_TIMESTAMP,track.getTimestamp());
  contentValues.put(TableInfo.COLUMN_STATE,track.getState());
  contentValues.put(TableInfo.COLUMN_STATE_TIMESTAMP,track.getStateTimestamp());
  return contentValues;
}

Fixed version (ground truth):
public static ContentValues asContentValues(Track track){
  final ContentValues contentValues=new ContentValues();
  contentValues.put(TableInfo.COLUMN_PLAYER_PACKAGE_NAME,track.getPlayerPackageName());
  contentValues.put(TableInfo.COLUMN_TRACK,track.getTrack());
  contentValues.put(TableInfo.COLUMN_ARTIST,track.getArtist());
  contentValues.put(TableInfo.COLUMN_ALBUM,track.getAlbum());
  contentValues.put(TableInfo.COLUMN_DURATION,track.getDuration());
  contentValues.put(TableInfo.COLUMN_TIMESTAMP,track.getTimestamp());
  contentValues.put(TableInfo.COLUMN_STATE,track.getState());
  contentValues.put(TableInfo.COLUMN_STATE_TIMESTAMP,track.getStateTimestamp());
  return contentValues;
}
Program: 166858
Project: 166858
Buggy source:
/** 
 * Checks equality only of some Track's fields
 * @param track to compare
 * @return true if special fields are equal, false otherwise
 */
public boolean specialEquals(Track track){
  if (track == null)   return false;
  if (!StringUtil.equals(getPlayerPackageName(),track.getPlayerPackageName())) {
    return false;
  }
  if (!StringUtil.equals(getTrack(),track.getTrack())) {
    return false;
  }
  if (!StringUtil.equals(getAlbum(),track.getAlbum())) {
    return false;
  }
  if (duration != track.getDurationInMillis()) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks equality only of some Track's fields
 * @param track to compare
 * @return true if special fields are equal, false otherwise
 */
public boolean specialEquals(Track track){
  if (track == null)   return false;
  if (!StringUtil.equals(getPlayerPackageName(),track.getPlayerPackageName())) {
    return false;
  }
  if (!StringUtil.equals(getTrack(),track.getTrack())) {
    return false;
  }
  if (!StringUtil.equals(getAlbum(),track.getAlbum())) {
    return false;
  }
  if (duration != track.getDuration()) {
    return false;
  }
  return true;
}
Program: 166860
Project: 166860
Buggy source:
@OnClick(R.id.settings_logout_menu_item) public void logout(){
  new MaterialDialog.Builder(getActivity()).theme(Theme.DARK).title(R.string.setting_logout_warning).positiveText("String_Node_Str").negativeText(R.string.dialog_cancel).callback(new MaterialDialog.ButtonCallback(){
    @Override public void onPositive(    MaterialDialog dialog){
      WAILSettings.clearAllSettings(getActivity());
      AppDBManager.getInstance(getActivity()).clearAll();
      startActivity(new Intent(getActivity(),NonAuthorizedActivity.class));
      getActivity().finish();
    }
    @Override public void onNegative(    MaterialDialog dialog){
      dialog.dismiss();
    }
  }
).build().show();
}

Fixed version (ground truth):
@OnClick(R.id.settings_logout_menu_item) public void logout(){
  new MaterialDialog.Builder(getActivity()).theme(Theme.DARK).title(R.string.setting_logout_warning).positiveText("String_Node_Str").negativeText(R.string.dialog_cancel).callback(new MaterialDialog.ButtonCallback(){
    @Override public void onPositive(    MaterialDialog dialog){
      WAILSettings.clearAllSettings(getActivity());
      AppDBManager.getInstance(getActivity()).clearAll();
      LocaleUtil.updateLanguage(getActivity(),null);
      startActivity(new Intent(getActivity(),MainActivity.class));
      getActivity().finish();
    }
    @Override public void onNegative(    MaterialDialog dialog){
      dialog.dismiss();
    }
  }
).build().show();
}
Program: 166861
Project: 166861
Buggy source:
@Override public void onPositive(MaterialDialog dialog){
  WAILSettings.clearAllSettings(getActivity());
  AppDBManager.getInstance(getActivity()).clearAll();
  startActivity(new Intent(getActivity(),NonAuthorizedActivity.class));
  getActivity().finish();
}

Fixed version (ground truth):
@Override public void onPositive(MaterialDialog dialog){
  WAILSettings.clearAllSettings(getActivity());
  AppDBManager.getInstance(getActivity()).clearAll();
  LocaleUtil.updateLanguage(getActivity(),null);
  startActivity(new Intent(getActivity(),MainActivity.class));
  getActivity().finish();
}
Program: 166862
Project: 166862
Buggy source:
public static synchronized String getLanguage(Context context){
  return getSharedPreferences(context).getString(KEY_LOCALE,Locale.getDefault().getLanguage());
}

Fixed version (ground truth):
public static synchronized String getLanguage(Context context){
  return getSharedPreferences(context).getString(KEY_LOCALE,null);
}
Program: 166863
Project: 166863
Buggy source:
public static void updateLanguage(Context context,String newLanguage){
  Configuration configuration=new Configuration();
  String language=WAILSettings.getLanguage(context);
  String lang=lang(language);
  String newLang=lang(newLanguage);
  if (TextUtils.isEmpty(language) && newLanguage == null) {
    configuration.locale=Locale.getDefault();
  }
 else   if (newLanguage != null) {
    configuration.locale=new Locale(newLang);
    WAILSettings.setLanguage(context,newLanguage);
  }
 else   if (!TextUtils.isEmpty(language)) {
    configuration.locale=new Locale(lang);
  }
  context.getResources().updateConfiguration(configuration,null);
  if (newLang != null && !lang.equals(newLang)) {
    Intent intent=context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);
  }
}

Fixed version (ground truth):
public static void updateLanguage(Context context,String newLanguage){
  Configuration configuration=new Configuration();
  String language=WAILSettings.getLanguage(context);
  String lang=lang(language);
  String newLang=lang(newLanguage);
  if (TextUtils.isEmpty(language) && newLanguage == null) {
    configuration.locale=Locale.getDefault();
  }
 else   if (newLanguage != null) {
    configuration.locale=new Locale(newLang);
    WAILSettings.setLanguage(context,newLanguage);
  }
 else   if (!TextUtils.isEmpty(language)) {
    configuration.locale=new Locale(lang);
  }
  context.getResources().updateConfiguration(configuration,null);
  if (newLang != null && !newLang.equals(lang)) {
    Intent intent=context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    context.startActivity(intent);
  }
}
Program: 166865
Project: 166865
Buggy source:
@OnCheckedChanged(R.id.settings_disable_scrobbling_over_mobile_network_switch) public void onDisableScrobblingOverMobileChanged(boolean isChecked){
  WAILSettings.setDisableScrobblingOverMobileNetwork(getActivity(),isChecked);
}

Fixed version (ground truth):
@OnCheckedChanged(R.id.settings_disable_scrobbling_over_mobile_network_switch) public void onDisableScrobblingOverMobileChanged(boolean isChecked){
  if (isChecked == WAILSettings.isEnableScrobblingOverMobileNetwork(getActivity())) {
    return;
  }
  WAILSettings.setDisableScrobblingOverMobileNetwork(getActivity(),isChecked);
  final String toast=isChecked ? getString(R.string.settings_scrobbling_over_mobile_network_enabled_toast) : getString(R.string.settings_scrobbling_over_mobile_network_disabled_toast);
  Toast.makeText(getActivity(),toast,Toast.LENGTH_SHORT).show();
  EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,"String_Node_Str" + isChecked,null,isChecked ? 1L : 0L).build());
}
Program: 166866
Project: 166866
Buggy source:
@OnCheckedChanged(R.id.settings_lastfm_update_nowplaying_switch) public void onLastfmUpdateNowPlayingChanged(boolean isChecked){
  WAILSettings.setLastfmNowplayingUpdateEnabled(getActivity(),isChecked);
  final String toast=isChecked ? getString(R.string.settings_lastfm_update_nowplaying_enabled_toast) : getString(R.string.settings_lastfm_update_nowplaying_disabled_toast);
  Toast.makeText(getActivity(),toast,Toast.LENGTH_SHORT).show();
  EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,"String_Node_Str" + isChecked,null,isChecked ? 1L : 0L).build());
}

Fixed version (ground truth):
@OnCheckedChanged(R.id.settings_lastfm_update_nowplaying_switch) public void onLastfmUpdateNowPlayingChanged(boolean isChecked){
  if (isChecked == WAILSettings.isLastfmNowplayingUpdateEnabled(getActivity())) {
    return;
  }
  WAILSettings.setLastfmNowplayingUpdateEnabled(getActivity(),isChecked);
  final String toast=isChecked ? getString(R.string.settings_lastfm_update_nowplaying_enabled_toast) : getString(R.string.settings_lastfm_update_nowplaying_disabled_toast);
  Toast.makeText(getActivity(),toast,Toast.LENGTH_SHORT).show();
  EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_FRAGMENT,"String_Node_Str" + isChecked,null,isChecked ? 1L : 0L).build());
}
Program: 166867
Project: 166867
Buggy source:
@OnCheckedChanged(R.id.settings_sound_notifications_track_skipped_switch) public void onTrackSkippedChanged(boolean isChecked){
  final Activity activity=getActivity();
  WAILSettings.setSoundNotificationTrackSkippedEnabled(activity,isChecked);
  EasyTracker.getInstance(activity).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_SOUND_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}

Fixed version (ground truth):
@OnCheckedChanged(R.id.settings_sound_notifications_track_skipped_switch) public void onTrackSkippedChanged(boolean isChecked){
  final Activity activity=getActivity();
  if (isChecked == WAILSettings.isSoundNotificationTrackSkippedEnabled(activity)) {
    return;
  }
  WAILSettings.setSoundNotificationTrackSkippedEnabled(activity,isChecked);
  EasyTracker.getInstance(activity).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_SOUND_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}
Program: 166868
Project: 166868
Buggy source:
@OnCheckedChanged(R.id.settings_sound_notifications_track_marked_as_scrobbled_switch) public void onTrackMarkedAsScrobbledChanged(boolean isChecked){
  final Activity activity=getActivity();
  WAILSettings.setSoundNotificationTrackMarkedAsScrobbledEnabled(activity,isChecked);
  EasyTracker.getInstance(activity).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_SOUND_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}

Fixed version (ground truth):
@OnCheckedChanged(R.id.settings_sound_notifications_track_marked_as_scrobbled_switch) public void onTrackMarkedAsScrobbledChanged(boolean isChecked){
  final Activity activity=getActivity();
  if (isChecked == WAILSettings.isSoundNotificationTrackMarkedAsScrobbledEnabled(activity)) {
    return;
  }
  WAILSettings.setSoundNotificationTrackMarkedAsScrobbledEnabled(activity,isChecked);
  EasyTracker.getInstance(activity).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_SOUND_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}
Program: 166869
Project: 166869
Buggy source:
@OnCheckedChanged(R.id.settings_status_bar_notifications_track_now_scrobbling_switch) public void onStatusBarNotificationSwitchChanged(boolean isChecked){
  WAILSettings.setStatusBarNotificationTrackScrobblingEnabled(getActivity(),isChecked);
  if (isChecked) {
    Track track=WAILSettings.getNowScrobblingTrack(getActivity());
    if (track != null) {
      StatusBarNotificationsManager.getInstance(getActivity()).showTrackScrobblingStatusBarNotification(track);
    }
  }
 else {
    StatusBarNotificationsManager.getInstance(getActivity()).cancelAllNotifications();
  }
  EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_STATUS_BAR_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}

Fixed version (ground truth):
@OnCheckedChanged(R.id.settings_status_bar_notifications_track_now_scrobbling_switch) public void onStatusBarNotificationSwitchChanged(boolean isChecked){
  if (isChecked == WAILSettings.isStatusBarNotificationTrackScrobblingEnabled(getActivity())) {
    return;
  }
  WAILSettings.setStatusBarNotificationTrackScrobblingEnabled(getActivity(),isChecked);
  if (isChecked) {
    Track track=WAILSettings.getNowScrobblingTrack(getActivity());
    if (track != null) {
      StatusBarNotificationsManager.getInstance(getActivity()).showTrackScrobblingStatusBarNotification(track);
    }
  }
 else {
    StatusBarNotificationsManager.getInstance(getActivity()).cancelAllNotifications();
  }
  EasyTracker.getInstance(getActivity()).send(MapBuilder.createEvent(GA_EVENT_SETTINGS_STATUS_BAR_NOTIFICATIONS,"String_Node_Str",isChecked ? "String_Node_Str" : "String_Node_Str",isChecked ? 1L : 0L).build());
}
Program: 166870
Project: 166870
Buggy source:
private void refreshMinTrackDurationInPercents(){
  minDurationInSecondsDescription.setText(getString(R.string.settings_min_track_elapsed_time_in_percent_desc,WAILSettings.getMinTrackDurationInPercents(getActivity())));
}

Fixed version (ground truth):
private void refreshMinTrackDurationInPercents(){
  minDurationInPercentsDescription.setText(getString(R.string.settings_min_track_elapsed_time_in_percent_desc,WAILSettings.getMinTrackDurationInPercents(getActivity())));
}