nus-yam/ex-repair huggingface dataset:
Program: 20199
Project: 20199
Buggy source:
private static ArrayList<Integer> readFeaturesFromFile(File file,Alphabet dataAlphabet){
  ArrayList<Integer> features=new ArrayList<Integer>();
  try {
    BufferedReader reader=new BufferedReader(new FileReader(file));
    String line=reader.readLine().trim();
    while (line != null) {
      int featureIndex=dataAlphabet.lookupIndex(line,false);
      features.add(featureIndex);
      line=reader.readLine().trim();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  return features;
}

Fixed version (ground truth):
private static ArrayList<Integer> readFeaturesFromFile(File file,Alphabet dataAlphabet){
  ArrayList<Integer> features=new ArrayList<Integer>();
  try {
    BufferedReader reader=new BufferedReader(new FileReader(file));
    String line=reader.readLine();
    while (line != null) {
      line=line.trim();
      int featureIndex=dataAlphabet.lookupIndex(line,false);
      features.add(featureIndex);
      line=reader.readLine();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    System.exit(1);
  }
  return features;
}
Program: 20202
Project: 20202
Buggy source:
/** 
 * Return an array (one element for each topic) of arrays of words, which are the most probable words for that topic in descending order. These are returned as Objects, but will probably be Strings.
 * @param numWords The maximum length of each topic's array of words (may be less).
 */
public Object[][] getTopWords(int numWords){
  TreeSet[] topicSortedWords=getSortedWords();
  Object[][] result=new Object[numTopics][];
  for (int topic=0; topic < numTopics; topic++) {
    TreeSet<IDSorter> sortedWords=topicSortedWords[topic];
    int limit=numWords;
    if (sortedWords.size() < numWords) {
      numWords=sortedWords.size();
    }
    result[topic]=new Object[limit];
    Iterator<IDSorter> iterator=sortedWords.iterator();
    for (int i=0; i < limit; i++) {
      IDSorter info=iterator.next();
      result[topic][i]=alphabet.lookupObject(info.getID());
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Return an array (one element for each topic) of arrays of words, which are the most probable words for that topic in descending order. These are returned as Objects, but will probably be Strings.
 * @param numWords The maximum length of each topic's array of words (may be less).
 */
public Object[][] getTopWords(int numWords){
  TreeSet[] topicSortedWords=getSortedWords();
  Object[][] result=new Object[numTopics][];
  for (int topic=0; topic < numTopics; topic++) {
    TreeSet<IDSorter> sortedWords=topicSortedWords[topic];
    int limit=numWords;
    if (sortedWords.size() < numWords) {
      limit=sortedWords.size();
    }
    result[topic]=new Object[limit];
    Iterator<IDSorter> iterator=sortedWords.iterator();
    for (int i=0; i < limit; i++) {
      IDSorter info=iterator.next();
      result[topic][i]=alphabet.lookupObject(info.getID());
    }
  }
  return result;
}
Program: 20203
Project: 20203
Buggy source:
public Instance next(){
  AgglomerativeNeighbor neighbor=null;
  if (positiveCount < positiveTarget) {
    positiveCount++;
    int label=nonsingletonClusters[random.nextInt(nonsingletonClusters.length)];
    int[] instances=clustering.getIndicesWithLabel(label);
    int[] subcluster=sampleFromArray(instances,random,2);
    int[] cluster1=new int[]{subcluster[random.nextInt(subcluster.length)]};
    int[] cluster2=new int[subcluster.length - 1];
    int nadded=0;
    for (int i=0; i < subcluster.length; i++)     if (subcluster[i] != cluster1[0])     cluster2[nadded++]=subcluster[i];
    neighbor=new AgglomerativeNeighbor(clustering,clustering,cluster1,cluster2);
  }
 else {
    int labeli=random.nextInt(clustering.getNumClusters());
    int labelj=random.nextInt(clustering.getNumClusters());
    while (labeli == labelj)     labelj=random.nextInt(clustering.getNumClusters());
    int[] ii=sampleFromArray(clustering.getIndicesWithLabel(labeli),random,1);
    int[] ij=sampleFromArray(clustering.getIndicesWithLabel(labelj),random,1);
    neighbor=new AgglomerativeNeighbor(clustering,ClusterUtils.copyAndMergeClusters(clustering,labeli,labelj),ii,new int[]{ij[random.nextInt(ij.length)]});
  }
  totalCount++;
  return new Instance(neighbor,null,null,null);
}

Fixed version (ground truth):
public Instance next(){
  AgglomerativeNeighbor neighbor=null;
  if (positiveCount < positiveTarget && nonsingletonClusters.length > 0) {
    positiveCount++;
    int label=nonsingletonClusters[random.nextInt(nonsingletonClusters.length)];
    int[] instances=clustering.getIndicesWithLabel(label);
    int[] subcluster=sampleFromArray(instances,random,2);
    int[] cluster1=new int[]{subcluster[random.nextInt(subcluster.length)]};
    int[] cluster2=new int[subcluster.length - 1];
    int nadded=0;
    for (int i=0; i < subcluster.length; i++)     if (subcluster[i] != cluster1[0])     cluster2[nadded++]=subcluster[i];
    neighbor=new AgglomerativeNeighbor(clustering,clustering,cluster1,cluster2);
  }
 else {
    int labeli=random.nextInt(clustering.getNumClusters());
    int labelj=random.nextInt(clustering.getNumClusters());
    while (labeli == labelj)     labelj=random.nextInt(clustering.getNumClusters());
    int[] ii=sampleFromArray(clustering.getIndicesWithLabel(labeli),random,1);
    int[] ij=sampleFromArray(clustering.getIndicesWithLabel(labelj),random,1);
    neighbor=new AgglomerativeNeighbor(clustering,ClusterUtils.copyAndMergeClusters(clustering,labeli,labelj),ii,new int[]{ij[random.nextInt(ij.length)]});
  }
  totalCount++;
  return new Instance(neighbor,null,null,null);
}
Program: 20204
Project: 20204
Buggy source:
/** 
 * @param clustering True clustering.
 * @param random Source of randomness.
 * @param positiveProportion Proportion of Instances that should be positive examples.
 * @param numberSamples Total number of samples to generate.
 * @return
 */
public NodeClusterSampleIterator(Clustering clustering,Randoms random,double positiveProportion,int numberSamples){
  super(clustering,random,positiveProportion,numberSamples);
}

Fixed version (ground truth):
/** 
 * @param clustering True clustering.
 * @param random Source of randomness.
 * @param positiveProportion Proportion of Instances that should be positive examples.
 * @param numberSamples Total number of samples to generate.
 * @return
 */
public NodeClusterSampleIterator(Clustering clustering,Randoms random,double positiveProportion,int numberSamples){
  super(clustering,random,positiveProportion,numberSamples);
  this.random=random;
  this.positiveProportion=positiveProportion;
  this.numberSamples=numberSamples;
}
Program: 20206
Project: 20206
Buggy source:
public void incrementTransition(Transducer.TransitionIterator ti,double count){
  State source=(HMM.State)ti.getSourceState();
  Integer inputFeature=(Integer)ti.getInput();
  int index=ti.getIndex();
  emissionEstimator[index].increment(inputAlphabet.lookupIndex(inputFeature.intValue(),false),count);
  transitionEstimator[source.getIndex()].increment(source.destinationNames[index],count);
}

Fixed version (ground truth):
public void incrementTransition(Transducer.TransitionIterator ti,double count){
  State source=(HMM.State)ti.getSourceState();
  Integer inputFeature=(Integer)ti.getInput();
  int index=ti.getIndex();
  emissionEstimator[index].increment(inputFeature.intValue(),count);
  transitionEstimator[source.getIndex()].increment(source.destinationNames[index],count);
}
Program: 20207
Project: 20207
Buggy source:
private void normalizeCosts(){
  sum=Transducer.IMPOSSIBLE_WEIGHT;
  for (int i=0; i < weights.length; i++)   sum=sumLogProb(sum,weights[i]);
  assert(!Double.isNaN(sum));
  if (!Double.isInfinite(sum)) {
    for (int i=0; i < weights.length; i++)     weights[i]=sum;
  }
}

Fixed version (ground truth):
private void normalizeCosts(){
  sum=Transducer.IMPOSSIBLE_WEIGHT;
  for (int i=0; i < weights.length; i++)   sum=sumLogProb(sum,weights[i]);
  assert(!Double.isNaN(sum));
  if (!Double.isInfinite(sum)) {
    for (int i=0; i < weights.length; i++)     weights[i]-=sum;
  }
}
Program: 20208
Project: 20208
Buggy source:
public static void main(String[] args) throws IOException {
  InstanceList training=InstanceList.load(new File(args[0]));
  int numTopics=args.length > 1 ? Integer.parseInt(args[1]) : 200;
  InstanceList testing=args.length > 2 ? InstanceList.load(new File(args[2])) : null;
  LDAHyper lda=new LDAHyper(numTopics,50.0,0.01);
  lda.addInstances(training);
  lda.estimate();
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  InstanceList training=InstanceList.load(new File(args[0]));
  int numTopics=args.length > 1 ? Integer.parseInt(args[1]) : 200;
  InstanceList testing=args.length > 2 ? InstanceList.load(new File(args[2])) : null;
  LDAHyper lda=new LDAHyper(numTopics,50.0,0.01);
  lda.printLogLikelihood=true;
  lda.setTopicDisplay(50,7);
  lda.addInstances(training);
  lda.estimate();
}
Program: 20211
Project: 20211
Buggy source:
public int getIteration(){
  if (ome == null)   return 0;
 else   return opt.getIteration();
}

Fixed version (ground truth):
public int getIteration(){
  if (ome == null)   return 0;
 else   return Integer.MAX_VALUE;
}
Program: 20212
Project: 20212
Buggy source:
public MaxEnt train(InstanceList trainingSet,int numIterations){
  logger.fine("String_Node_Str" + trainingSet.size());
  boolean converged;
  getOptimizer(trainingSet);
  for (int i=0; i < numIterations; i++) {
    try {
      converged=opt.optimize(1);
    }
 catch (    IllegalArgumentException e) {
      e.printStackTrace();
      logger.info("String_Node_Str");
      converged=true;
    }
    if (converged)     break;
  }
  if (numIterations == Integer.MAX_VALUE) {
    opt.reset();
    try {
      opt.optimize();
    }
 catch (    IllegalArgumentException e) {
      e.printStackTrace();
      logger.info("String_Node_Str");
    }
  }
  progressLogger.info("String_Node_Str");
  return ome.getClassifier();
}

Fixed version (ground truth):
public MaxEnt train(InstanceList trainingSet,int numIterations){
  logger.fine("String_Node_Str" + trainingSet.size());
  boolean converged;
  getOptimizer(trainingSet);
  for (int i=0; i < numIterations; i++) {
    try {
      converged=opt.optimize(1);
    }
 catch (    IllegalArgumentException e) {
      e.printStackTrace();
      logger.info("String_Node_Str");
      converged=true;
    }
    if (converged)     break;
  }
  if (numIterations == Integer.MAX_VALUE) {
    opt=null;
    getOptimizer();
    try {
      opt.optimize();
    }
 catch (    IllegalArgumentException e) {
      e.printStackTrace();
      logger.info("String_Node_Str");
    }
  }
  progressLogger.info("String_Node_Str");
  return ome.getClassifier();
}
Program: 20213
Project: 20213
Buggy source:
public void postParsing(CommandOption.List list){
  assert(this.value instanceof ClassifierTrainer);
  classifierTrainers.add(this.value);
}

Fixed version (ground truth):
public void postParsing(CommandOption.List list){
  assert(this.value instanceof ClassifierTrainer);
  classifierTrainers.add((ClassifierTrainer)this.value);
}
Program: 20216
Project: 20216
Buggy source:
public void printState(PrintStream out){
  out.println("String_Node_Str");
  for (int di=0; di < data.size(); di++) {
    FeatureSequence tokenSequence=(FeatureSequence)data.get(di).instance.getData();
    LabelSequence topicSequence=(LabelSequence)data.get(di).topicSequence;
    String source=data.get(di).instance.getSource().toString();
    for (int pi=0; pi < topicSequence.getLength(); pi++) {
      int type=tokenSequence.getIndexAtPosition(pi);
      int topic=topicSequence.getIndexAtPosition(pi);
      out.print(di);
      out.print(' ');
      out.print(source);
      out.print(' ');
      out.print(pi);
      out.print(' ');
      out.print(type);
      out.print(' ');
      out.print(alphabet.lookupObject(type));
      out.print(' ');
      out.print(topic);
      out.println();
    }
  }
}

Fixed version (ground truth):
public void printState(PrintStream out){
  out.println("String_Node_Str");
  for (int di=0; di < data.size(); di++) {
    FeatureSequence tokenSequence=(FeatureSequence)data.get(di).instance.getData();
    LabelSequence topicSequence=(LabelSequence)data.get(di).topicSequence;
    String source="String_Node_Str";
    if (data.get(di).instance.getSource() != null) {
      source=data.get(di).instance.getSource().toString();
    }
    for (int pi=0; pi < topicSequence.getLength(); pi++) {
      int type=tokenSequence.getIndexAtPosition(pi);
      int topic=topicSequence.getIndexAtPosition(pi);
      out.print(di);
      out.print(' ');
      out.print(source);
      out.print(' ');
      out.print(pi);
      out.print(' ');
      out.print(type);
      out.print(' ');
      out.print(alphabet.lookupObject(type));
      out.print(' ');
      out.print(topic);
      out.println();
    }
  }
}
Program: 20217
Project: 20217
Buggy source:
private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeInt(CURRENT_SERIAL_VERSION);
  out.writeObject(prefix);
}

Fixed version (ground truth):
private void writeObject(ObjectOutputStream out) throws IOException {
  out.writeInt(CURRENT_SERIAL_VERSION);
  out.writeObject(prefix);
  out.writeObject(matchingRegex);
}
Program: 20218
Project: 20218
Buggy source:
public Instance pipe(Instance carrier){
  TokenSequence ts=(TokenSequence)carrier.getData();
  for (int i=0; i < ts.size(); i++) {
    Token t=ts.get(i);
    if (matchingRegex != null && matchingRegex.matcher(t.getText()).matches())     t.setFeatureValue(prefix == null ? t.getText().intern() : (prefix + t.getText()).intern(),1.0);
  }
  return carrier;
}

Fixed version (ground truth):
public Instance pipe(Instance carrier){
  TokenSequence ts=(TokenSequence)carrier.getData();
  for (int i=0; i < ts.size(); i++) {
    Token t=ts.get(i);
    if (matchingRegex == null || matchingRegex.matcher(t.getText()).matches()) {
      t.setFeatureValue(prefix == null ? t.getText().intern() : (prefix + t.getText()).intern(),1.0);
    }
  }
  return carrier;
}
Program: 20219
Project: 20219
Buggy source:
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  int version=in.readInt();
  prefix=(String)in.readObject();
}

Fixed version (ground truth):
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
  int version=in.readInt();
  prefix=(String)in.readObject();
  if (version > 0)   matchingRegex=(Pattern)in.readObject();
}
Program: 20220
Project: 20220
Buggy source:
public RankedFeatureVector toRankedFeatureVector(){
  int[] indices=featureCounts.keys();
  double[] values=new double[indices.length];
  return new RankedFeatureVector(alphabet,indices,values);
}

Fixed version (ground truth):
public RankedFeatureVector toRankedFeatureVector(){
  int[] indices=featureCounts.keys();
  double[] values=new double[indices.length];
  for (int i=0; i < indices.length; i++)   values[i]=featureCounts.get(indices[i]);
  return new RankedFeatureVector(alphabet,indices,values);
}
Program: 20221
Project: 20221
Buggy source:
public FeatureVector toFeatureVector(){
  int[] indices=featureCounts.keys();
  double[] values=new double[indices.length];
  return new FeatureVector(alphabet,indices,values);
}

Fixed version (ground truth):
public FeatureVector toFeatureVector(){
  int[] indices=featureCounts.keys();
  double[] values=new double[indices.length];
  for (int i=0; i < indices.length; i++)   values[i]=featureCounts.get(indices[i]);
  return new FeatureVector(alphabet,indices,values);
}
Program: 20222
Project: 20222
Buggy source:
public boolean expandGroupWithAnimation(int groupPos){
  int childPos=getPackedPositionChild(getExpandableListPosition(getFirstVisiblePosition()));
  childPos=childPos == -1 ? 0 : childPos;
  adapter.startExpandAnimation(groupPos,childPos);
  return expandGroup(groupPos);
}

Fixed version (ground truth):
public boolean expandGroupWithAnimation(int groupPos){
  if (groupPos + 1 == adapter.getGroupCount()) {
    return expandGroup(groupPos);
  }
  int childPos=getPackedPositionChild(getExpandableListPosition(getFirstVisiblePosition()));
  childPos=childPos == -1 ? 0 : childPos;
  adapter.startExpandAnimation(groupPos,childPos);
  return expandGroup(groupPos);
}
Program: 20223
Project: 20223
Buggy source:
public boolean collapseGroupWithAnimation(int groupPos){
  int childPos=getPackedPositionChild(getExpandableListPosition(getFirstVisiblePosition()));
  childPos=childPos == -1 ? 0 : childPos;
  adapter.startCollapseAnimation(groupPos,childPos);
  adapter.notifyDataSetChanged();
  return isGroupExpanded(groupPos);
}

Fixed version (ground truth):
public boolean collapseGroupWithAnimation(int groupPos){
  int groupFlatPos=getFlatListPosition(getPackedPositionForGroup(groupPos));
  if (groupFlatPos != -1) {
    View v=getChildAt(groupFlatPos - getFirstVisiblePosition());
    if (v.getBottom() >= getBottom()) {
      return collapseGroup(groupPos);
    }
  }
  int childPos=getPackedPositionChild(getExpandableListPosition(getFirstVisiblePosition()));
  childPos=childPos == -1 ? 0 : childPos;
  adapter.startCollapseAnimation(groupPos,childPos);
  adapter.notifyDataSetChanged();
  return isGroupExpanded(groupPos);
}
Program: 20226
Project: 20226
Buggy source:
/** 
 * Expands the given group with an animation.
 * @param groupPos The position of the group to expand
 * @return  Returns true if the group was expanded. False if the group wasalready expanded.
 */
public boolean expandGroupWithAnimation(int groupPos){
  int groupFlatPos=getFlatListPosition(getPackedPositionForGroup(groupPos));
  if (groupFlatPos != -1) {
    int childIndex=groupFlatPos - getFirstVisiblePosition();
    if (childIndex < getChildCount()) {
      View v=getChildAt(childIndex);
      if (v.getBottom() >= getBottom()) {
        return expandGroup(groupPos);
      }
    }
  }
  adapter.startExpandAnimation(groupPos,0);
  return expandGroup(groupPos);
}

Fixed version (ground truth):
/** 
 * Expands the given group with an animation.
 * @param groupPos The position of the group to expand
 * @return  Returns true if the group was expanded. False if the group wasalready expanded.
 */
public boolean expandGroupWithAnimation(int groupPos){
  int groupFlatPos=getFlatListPosition(getPackedPositionForGroup(groupPos));
  if (groupFlatPos != -1) {
    int childIndex=groupFlatPos - getFirstVisiblePosition();
    if (childIndex < getChildCount()) {
      View v=getChildAt(childIndex);
      if (v.getBottom() >= getBottom()) {
        adapter.notifyGroupExpanded(groupPos);
        return expandGroup(groupPos);
      }
    }
  }
  adapter.startExpandAnimation(groupPos,0);
  return expandGroup(groupPos);
}
Program: 20227
Project: 20227
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  stopAnimation(groupPosition);
  listView.collapseGroup(groupPosition);
  notifyDataSetChanged();
  info.dummyHeight=-1;
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  stopAnimation(groupPosition);
  listView.collapseGroup(groupPosition);
  notifyDataSetChanged();
  info.dummyHeight=-1;
  dummyView.setTag(STATE_IDLE);
}
Program: 20229
Project: 20229
Buggy source:
@Override public void onAnimationEnd(Animation animation){
  stopAnimation(groupPosition);
  listView.collapseGroup(groupPosition);
  notifyDataSetChanged();
}

Fixed version (ground truth):
@Override public void onAnimationEnd(Animation animation){
  stopAnimation(groupPosition);
  listView.collapseGroup(groupPosition);
  notifyDataSetChanged();
  info.dummyHeight=-1;
}
Program: 20231
Project: 20231
Buggy source:
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  final int len=views.size();
  for (int i=0; i < len; i++) {
    View v=views.get(i);
    v.layout(left,top,right,bottom);
  }
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int left,int top,int right,int bottom){
  super.onLayout(changed,left,top,right,bottom);
  final int len=views.size();
  for (int i=0; i < len; i++) {
    View v=views.get(i);
    v.layout(left,top,left + v.getMeasuredWidth(),top + v.getMeasuredHeight());
  }
}
Program: 20232
Project: 20232
Buggy source:
/** 
 * Add a view for the DummyView to draw.
 * @param childView View to draw
 */
public void addFakeView(View childView){
  childView.layout(0,0,getWidth(),getHeight());
  views.add(childView);
}

Fixed version (ground truth):
/** 
 * Add a view for the DummyView to draw.
 * @param childView View to draw
 */
public void addFakeView(View childView){
  childView.layout(0,0,getWidth(),childView.getMeasuredHeight());
  views.add(childView);
}
Program: 20235
Project: 20235
Buggy source:
public Capabilities getCapabilities(){
  MutableCapabilities capabilities=(MutableCapabilities)super.getCapabilities();
  capabilities.setCapability(PLATFORM_NAME,ANDROID_PLATFORM);
  return capabilities;
}

Fixed version (ground truth):
/** 
 * Returns capabilities that were provided on instantiation.
 * @return given {@link Capabilities}
 */
public Capabilities getCapabilities(){
  MutableCapabilities capabilities=(MutableCapabilities)super.getCapabilities();
  capabilities.setCapability(PLATFORM_NAME,ANDROID_PLATFORM);
  return capabilities;
}
Program: 20236
Project: 20236
Buggy source:
public Capabilities getCapabilities(){
  MutableCapabilities capabilities=(MutableCapabilities)super.getCapabilities();
  capabilities.setCapability(PLATFORM_NAME,IOS_PLATFORM);
  return capabilities;
}

Fixed version (ground truth):
/** 
 * Returns capabilities that were provided on instantiation.
 * @return given {@link Capabilities}
 */
public Capabilities getCapabilities(){
  MutableCapabilities capabilities=(MutableCapabilities)super.getCapabilities();
  capabilities.setCapability(PLATFORM_NAME,IOS_PLATFORM);
  return capabilities;
}
Program: 20237
Project: 20237
Buggy source:
@Test @Ignore public void whenIOSHybridAppIsLaunched(){
  assertTrue(check(serverAppCapabilitiesSupplier,appFileSupplierFunction.apply(webViewApp),(by,aClass) -> {
    new WebDriverWait(driver,30).until(ExpectedConditions.presenceOfElementLocated(id("String_Node_Str"))).click();
    driver.findElementByAccessibilityId("String_Node_Str").click();
    new WebDriverWait(driver,30).until(ExpectedConditions.presenceOfElementLocated(AccessibilityId("String_Node_Str")));
    try {
      Thread.sleep(10000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    driver.getContextHandles().forEach((handle) -> {
      if (handle.contains("String_Node_Str")) {
        driver.context(handle);
      }
    }
);
    return commonPredicate.test(by,aClass);
  }
,partialLinkText("String_Node_Str"),IOSElement.class));
}

Fixed version (ground truth):
@Ignore @Test public void whenIOSHybridAppIsLaunched(){
  assertTrue(check(serverAppCapabilitiesSupplier,appFileSupplierFunction.apply(webViewApp),(by,aClass) -> {
    new WebDriverWait(driver,30).until(ExpectedConditions.presenceOfElementLocated(id("String_Node_Str"))).click();
    driver.findElementByAccessibilityId("String_Node_Str").click();
    new WebDriverWait(driver,30).until(ExpectedConditions.presenceOfElementLocated(AccessibilityId("String_Node_Str")));
    try {
      Thread.sleep(10000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    driver.getContextHandles().forEach((handle) -> {
      if (handle.contains("String_Node_Str")) {
        driver.context(handle);
      }
    }
);
    return commonPredicate.test(by,aClass);
  }
,partialLinkText("String_Node_Str"),IOSElement.class));
}
Program: 20238
Project: 20238
Buggy source:
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  String ipAddress=startAppiumServer();
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + ipAddress + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + startAppiumServer() + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}
Program: 20239
Project: 20239
Buggy source:
public static String startAppiumServer() throws UnknownHostException {
  service=new AppiumServiceBuilder().usingPort(PORT).build();
  service.start();
  InetAddress inetAddress=InetAddress.getLocalHost();
  return inetAddress.getHostAddress();
}

Fixed version (ground truth):
/** 
 * Starts a local server.
 * @return ip of a local host
 * @throws UnknownHostException when it is impossible to get ip address of a local host
 */
public static String startAppiumServer() throws UnknownHostException {
  service=new AppiumServiceBuilder().usingPort(PORT).build();
  service.start();
  InetAddress inetAddress=InetAddress.getLocalHost();
  return inetAddress.getHostAddress();
}
Program: 20240
Project: 20240
Buggy source:
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  String ipAddress=startAppiumServer();
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + ipAddress + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + startAppiumServer() + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}
Program: 20241
Project: 20241
Buggy source:
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  String ipAddress=startAppiumServer();
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  driver=new IOSDriver<>(new URL("String_Node_Str" + ipAddress + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.IOS_XCUI_TEST);
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  driver=new IOSDriver<>(new URL("String_Node_Str" + startAppiumServer() + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}
Program: 20242
Project: 20242
Buggy source:
@Test @Ignore public void geolocationTest(){
  Location location=new Location(45,45,100);
  try {
    driver.setLocation(location);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
}

Fixed version (ground truth):
@Ignore @Test public void geolocationTest(){
  Location location=new Location(45,45,100);
  try {
    driver.setLocation(location);
  }
 catch (  Exception e) {
    fail("String_Node_Str");
  }
}
Program: 20243
Project: 20243
Buggy source:
@Test @Ignore public void touchIdTest(){
  driver.toggleTouchIDEnrollment(true);
  driver.performTouchID(true);
  driver.performTouchID(false);
  assertEquals(true,true);
}

Fixed version (ground truth):
@Ignore @Test public void touchIdTest(){
  driver.toggleTouchIDEnrollment(true);
  driver.performTouchID(true);
  driver.performTouchID(false);
  assertEquals(true,true);
}
Program: 20244
Project: 20244
Buggy source:
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  String ipAddress=startAppiumServer();
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + ipAddress + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}

Fixed version (ground truth):
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
  if (service == null || !service.isRunning()) {
    throw new AppiumServerHasNotBeenStartedLocallyException("String_Node_Str");
  }
  File appDir=new File("String_Node_Str");
  File app=new File(appDir,"String_Node_Str");
  DesiredCapabilities capabilities=new DesiredCapabilities();
  capabilities.setCapability(MobileCapabilityType.BROWSER_NAME,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION,"String_Node_Str");
  capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,"String_Node_Str");
  capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT,500000);
  capabilities.setCapability(MobileCapabilityType.APP,app.getAbsolutePath());
  driver=new IOSDriver<>(new URL("String_Node_Str" + startAppiumServer() + "String_Node_Str"+ PORT+ "String_Node_Str"),capabilities);
}
Program: 20246
Project: 20246
Buggy source:
@Override public Response execute(Command command) throws WebDriverException, IOException {
  if (DriverCommand.NEW_SESSION.equals(command.getName())) {
    serviceOptional.ifPresent(driverService -> {
      try {
        driverService.start();
      }
 catch (      IOException e) {
        throw new WebDriverException(e.getMessage(),e);
      }
    }
);
  }
  Response response;
  try {
    if (!NEW_SESSION.equals(command.getName())) {
      response=super.execute(command);
    }
 else {
      response=createSession(command);
    }
  }
 catch (  Throwable t) {
    Throwable rootCause=Throwables.getRootCause(t);
    if (rootCause instanceof ConnectException && rootCause.getMessage().contains("String_Node_Str")) {
      throw serviceOptional.map(service -> {
        if (service.isRunning()) {
          return new WebDriverException("String_Node_Str",rootCause);
        }
        return new WebDriverException("String_Node_Str",rootCause);
      }
).orElseGet((Supplier<WebDriverException>)() -> new WebDriverException(rootCause.getMessage(),rootCause));
    }
    throwIfUnchecked(t);
    throw new WebDriverException(t);
  }
 finally {
    if (DriverCommand.QUIT.equals(command.getName())) {
      serviceOptional.ifPresent(DriverService::stop);
    }
  }
  if (DriverCommand.NEW_SESSION.equals(command.getName()) && getCommandCodec() instanceof W3CHttpCommandCodec) {
    setCommandCodec(new AppiumW3CHttpCommandCodec());
    getAdditionalCommands().forEach(this::defineCommand);
  }
  return response;
}

Fixed version (ground truth):
@Override public Response execute(Command command) throws WebDriverException, IOException {
  if (DriverCommand.NEW_SESSION.equals(command.getName())) {
    serviceOptional.ifPresent(driverService -> {
      try {
        driverService.start();
      }
 catch (      IOException e) {
        throw new WebDriverException(e.getMessage(),e);
      }
    }
);
  }
  Response response;
  try {
    response=NEW_SESSION.equals(command.getName()) ? createSession(command) : super.execute(command);
  }
 catch (  Throwable t) {
    Throwable rootCause=Throwables.getRootCause(t);
    if (rootCause instanceof ConnectException && rootCause.getMessage().contains("String_Node_Str")) {
      throw serviceOptional.map(service -> {
        if (service.isRunning()) {
          return new WebDriverException("String_Node_Str",rootCause);
        }
        return new WebDriverException("String_Node_Str",rootCause);
      }
).orElseGet((Supplier<WebDriverException>)() -> new WebDriverException(rootCause.getMessage(),rootCause));
    }
    throwIfUnchecked(t);
    throw new WebDriverException(t);
  }
 finally {
    if (DriverCommand.QUIT.equals(command.getName())) {
      serviceOptional.ifPresent(DriverService::stop);
    }
  }
  if (DriverCommand.NEW_SESSION.equals(command.getName()) && getCommandCodec() instanceof W3CHttpCommandCodec) {
    setCommandCodec(new AppiumW3CHttpCommandCodec());
    getAdditionalCommands().forEach(this::defineCommand);
  }
  return response;
}
Program: 20247
Project: 20247
Buggy source:
public void writeTo(Appendable appendable) throws IOException {
  try (JsonOutput json=new Json().newOutput(appendable)){
    json.beginObject();
    Map<String,Object> first=getOss();
    if (first == null) {
      first=(Map<String,Object>)stream().findFirst().orElse(new ImmutableCapabilities()).asMap();
    }
    json.name(DESIRED_CAPABILITIES);
    json.write(first);
    json.name(CAPABILITIES);
    json.beginObject();
    json.name(DESIRED_CAPABILITIES);
    json.write(first);
    json.name(FIRST_MATCH);
    json.beginArray();
    getW3C().forEach(json::write);
    json.endArray();
    json.endObject();
    writeMetaData(json);
    json.endObject();
  }
 }

Fixed version (ground truth):
/** 
 * Writes json capabilities to some appendable object.
 * @param appendable to write a json
 */
public void writeTo(Appendable appendable) throws IOException {
  try (JsonOutput json=new Json().newOutput(appendable)){
    json.beginObject();
    Map<String,Object> first=getOss();
    if (first == null) {
      first=(Map<String,Object>)stream().findFirst().orElse(new ImmutableCapabilities()).asMap();
    }
    json.name(DESIRED_CAPABILITIES);
    json.write(first);
    json.name(CAPABILITIES);
    json.beginObject();
    json.name(DESIRED_CAPABILITIES);
    json.write(first);
    json.name(FIRST_MATCH);
    json.beginArray();
    getW3C().forEach(json::write);
    json.endArray();
    json.endObject();
    writeMetaData(json);
    json.endObject();
  }
 }
Program: 20248
Project: 20248
Buggy source:
public static NewAppiumSessionPayload create(Capabilities caps) throws IOException {
  boolean forceMobileJSONWP=ofNullable(caps.getCapability(FORCE_MJSONWP)).map(o -> Boolean.class.isAssignableFrom(o.getClass()) && Boolean.class.cast(o)).orElse(false);
  HashMap<String,?> capabilityMap=new HashMap<>(caps.asMap());
  capabilityMap.remove(FORCE_MJSONWP);
  Map<String,?> source=of(DESIRED_CAPABILITIES,capabilityMap);
  String json=new Json().toJson(source);
  return new NewAppiumSessionPayload(new StringReader(json),forceMobileJSONWP);
}

Fixed version (ground truth):
/** 
 * Creates instance of   {@link NewAppiumSessionPayload}.
 * @param caps capabilities to create a new session
 * @return instance of {@link NewAppiumSessionPayload}
 */
public static NewAppiumSessionPayload create(Capabilities caps) throws IOException {
  boolean forceMobileJSONWP=ofNullable(caps.getCapability(FORCE_MJSONWP)).map(o -> Boolean.class.isAssignableFrom(o.getClass()) && Boolean.class.cast(o)).orElse(false);
  HashMap<String,?> capabilityMap=new HashMap<>(caps.asMap());
  capabilityMap.remove(FORCE_MJSONWP);
  Map<String,?> source=of(DESIRED_CAPABILITIES,capabilityMap);
  String json=new Json().toJson(source);
  return new NewAppiumSessionPayload(new StringReader(json),forceMobileJSONWP);
}
Program: 20249
Project: 20249
Buggy source:
/** 
 * The starting.
 */
@BeforeClass public static void beforeClass(){
  firefoxdriver().setup();
}

Fixed version (ground truth):
/** 
 * The starting.
 */
@BeforeClass public static void beforeClass(){
  chromedriver().setup();
}
Program: 20250
Project: 20250
Buggy source:
/** 
 * @return true if airplane mode is enabled.
 */
public boolean isAirplaneModeEnabled(){
  return (bitMask & AIRPLANE_MODE_MASK) != 0;
}

Fixed version (ground truth):
/** 
 * Is airplane mode enabled or not.
 * @return true if airplane mode is enabled.
 */
public boolean isAirplaneModeEnabled(){
  return (bitMask & AIRPLANE_MODE_MASK) != 0;
}
Program: 20251
Project: 20251
Buggy source:
/** 
 * @return true if data connection is enabled.
 */
public boolean isDataEnabled(){
  return (bitMask & DATA_MASK) != 0;
}

Fixed version (ground truth):
/** 
 * Is data connection enabled or not.
 * @return true if data connection is enabled.
 */
public boolean isDataEnabled(){
  return (bitMask & DATA_MASK) != 0;
}
Program: 20252
Project: 20252
Buggy source:
/** 
 * @return true if Wi-Fi connection is enabled.
 */
public boolean isWiFiEnabled(){
  return (bitMask & WIFI_MASK) != 0;
}

Fixed version (ground truth):
/** 
 * Is Wi-Fi connection enabled or not.
 * @return true if Wi-Fi connection is enabled.
 */
public boolean isWiFiEnabled(){
  return (bitMask & WIFI_MASK) != 0;
}
Program: 20253
Project: 20253
Buggy source:
/** 
 * Get an image from the clipboard
 * @return the actual image instance.
 * @throws IOException If the returned image cannot be decoded or if the clipboard is empty.
 */
default BufferedImage getClipboardImage() throws IOException {
  final byte[] base64decodedBytes=Base64.getMimeDecoder().decode(getClipboard(ClipboardContentType.IMAGE));
  return ImageIO.read(new ByteArrayInputStream(base64decodedBytes));
}

Fixed version (ground truth):
/** 
 * Get an image from the clipboard.
 * @return the actual image instance.
 * @throws IOException If the returned image cannot be decoded or if the clipboard is empty.
 */
default BufferedImage getClipboardImage() throws IOException {
  final byte[] base64decodedBytes=Base64.getMimeDecoder().decode(getClipboard(ClipboardContentType.IMAGE));
  return ImageIO.read(new ByteArrayInputStream(base64decodedBytes));
}
Program: 20254
Project: 20254
Buggy source:
/** 
 * Get an URL from the clipboard
 * @return the actual URL instance.
 * @throws MalformedURLException if the URL in the clipboard is not valid or if the clipboard is empty.
 */
default URL getClipboardUrl() throws MalformedURLException {
  final byte[] base64decodedBytes=Base64.getMimeDecoder().decode(getClipboard(ClipboardContentType.URL));
  return new URL(new String(base64decodedBytes,StandardCharsets.UTF_8));
}

Fixed version (ground truth):
/** 
 * Get an URL from the clipboard.
 * @return the actual URL instance.
 * @throws MalformedURLException if the URL in the clipboard is not valid or if the clipboard is empty.
 */
default URL getClipboardUrl() throws MalformedURLException {
  final byte[] base64decodedBytes=Base64.getMimeDecoder().decode(getClipboard(ClipboardContentType.URL));
  return new URL(new String(base64decodedBytes,StandardCharsets.UTF_8));
}
Program: 20255
Project: 20255
Buggy source:
/** 
 * @return The list of web socket connection handlers.
 */
List<Runnable> getConnectionHandlers();

Fixed version (ground truth):
/** 
 * Returns a list of all registered web socket connection handlers.
 * @return The list of web socket connection handlers.
 */
List<Runnable> getConnectionHandlers();
Program: 20256
Project: 20256
Buggy source:
/** 
 * @return The list of web socket disconnection handlers.
 */
List<Runnable> getDisconnectionHandlers();

Fixed version (ground truth):
/** 
 * Returns a list of all registered web socket disconnection handlers.
 * @return The list of web socket disconnection handlers.
 */
List<Runnable> getDisconnectionHandlers();
Program: 20257
Project: 20257
Buggy source:
/** 
 * @return The list of web socket error handlers.
 */
List<Consumer<Throwable>> getErrorHandlers();

Fixed version (ground truth):
/** 
 * Returns a list of all registered web socket error handlers.
 * @return The list of web socket error handlers.
 */
List<Consumer<Throwable>> getErrorHandlers();
Program: 20258
Project: 20258
Buggy source:
/** 
 * @return The list of web socket message handlers.
 */
List<Consumer<T>> getMessageHandlers();

Fixed version (ground truth):
/** 
 * Returns a list of all registered web socket messages handlers.
 * @return The list of web socket message handlers.
 */
List<Consumer<T>> getMessageHandlers();
Program: 20259
Project: 20259
Buggy source:
/** 
 * @return The list of all registered web socket disconnection handlers.
 */
@Override public List<Runnable> getDisconnectionHandlers(){
  return disconnectHandlers;
}

Fixed version (ground truth):
@Override public List<Runnable> getDisconnectionHandlers(){
  return disconnectHandlers;
}
Program: 20260
Project: 20260
Buggy source:
/** 
 * @return The list of all registered web socket error handlers.
 */
@Override public List<Consumer<Throwable>> getErrorHandlers(){
  return errorHandlers;
}

Fixed version (ground truth):
@Override public List<Consumer<Throwable>> getErrorHandlers(){
  return errorHandlers;
}
Program: 20261
Project: 20261
Buggy source:
/** 
 * @return The list of all registered web socket connection handlers.
 */
@Override public List<Runnable> getConnectionHandlers(){
  return connectHandlers;
}

Fixed version (ground truth):
@Override public List<Runnable> getConnectionHandlers(){
  return connectHandlers;
}
Program: 20262
Project: 20262
Buggy source:
/** 
 * @return The list of all registered web socket messages handlers.
 */
@Override public List<Consumer<String>> getMessageHandlers(){
  return messageHandlers;
}

Fixed version (ground truth):
@Override public List<Consumer<String>> getMessageHandlers(){
  return messageHandlers;
}
Program: 20263
Project: 20263
Buggy source:
/** 
 * @return Battery level in range [0.0, 1.0], where 1.0 means 100% charge.
 */
public double getLevel(){
  final Object value=getInput().get("String_Node_Str");
  if (value instanceof Long) {
    return ((Long)value).doubleValue();
  }
  return (double)value;
}

Fixed version (ground truth):
/** 
 * Returns battery level.
 * @return Battery level in range [0.0, 1.0], where 1.0 means 100% charge.
 */
public double getLevel(){
  final Object value=getInput().get("String_Node_Str");
  if (value instanceof Long) {
    return ((Long)value).doubleValue();
  }
  return (double)value;
}
Program: 20264
Project: 20264
Buggy source:
/** 
 * @return Battery state value.
 */
public abstract <T>T getState();

Fixed version (ground truth):
/** 
 * Returns battery state.
 * @return Battery state value.
 */
public abstract <T>T getState();
Program: 20265
Project: 20265
Buggy source:
@Test public void checkAbilityToStartServiceUsingCapabilities(){
  File app=ROOT_TEST_PATH.resolve("String_Node_Str").toFile();
  DesiredCapabilities caps=new DesiredCapabilities();
  caps.setCapability(PLATFORM_NAME,"String_Node_Str");
  caps.setCapability(FULL_RESET,true);
  caps.setCapability(NEW_COMMAND_TIMEOUT,60);
  caps.setCapability(APP_PACKAGE,"String_Node_Str");
  caps.setCapability(APP_ACTIVITY,"String_Node_Str");
  caps.setCapability(APP,app.getAbsolutePath());
  caps.setCapability(CHROMEDRIVER_EXECUTABLE,getPathToChromeDriverBinary());
  service=new AppiumServiceBuilder().withCapabilities(caps).build();
  service.start();
  assertTrue(service.isRunning());
}

Fixed version (ground truth):
@Test public void checkAbilityToStartServiceUsingCapabilities(){
  File app=ROOT_TEST_PATH.resolve("String_Node_Str").toFile();
  DesiredCapabilities caps=new DesiredCapabilities();
  caps.setCapability(PLATFORM_NAME,"String_Node_Str");
  caps.setCapability(FULL_RESET,true);
  caps.setCapability(NEW_COMMAND_TIMEOUT,60);
  caps.setCapability(APP_PACKAGE,"String_Node_Str");
  caps.setCapability(APP_ACTIVITY,"String_Node_Str");
  caps.setCapability(APP,app.getAbsolutePath());
  caps.setCapability(CHROMEDRIVER_EXECUTABLE,chromeManager.getBinaryPath());
  service=new AppiumServiceBuilder().withCapabilities(caps).build();
  service.start();
  assertTrue(service.isRunning());
}
Program: 20266
Project: 20266
Buggy source:
/** 
 * initialization.
 */
@BeforeClass public static void beforeClass() throws Exception {
  for (Enumeration<NetworkInterface> en=NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
    NetworkInterface intf=en.nextElement();
    if ((testIP=getLocalIP(intf)) != null) {
      break;
    }
  }
}

Fixed version (ground truth):
/** 
 * initialization.
 */
@BeforeClass public static void beforeClass() throws Exception {
  for (Enumeration<NetworkInterface> en=NetworkInterface.getNetworkInterfaces(); en.hasMoreElements(); ) {
    NetworkInterface intf=en.nextElement();
    if ((testIP=getLocalIP(intf)) != null) {
      break;
    }
  }
  chromeManager=chromedriver();
  chromeManager.setup();
}