nus-yam/ex-repair huggingface dataset:
Program: 131426
Project: 131426
Buggy source:
private FgExampleList getData(ObsFeatureConjoiner ofc,CorpusStatistics cs,String name,SimpleAnnoSentenceCollection sents,SrlFeatureExtractorPrm srlFePrm){
  if (!cs.isInitialized()) {
    log.info("String_Node_Str");
    cs.init(sents);
  }
  FactorTemplateList fts=ofc.getTemplates();
  if (useTemplates) {
    SimpleAnnoSentence sent=sents.get(0);
    TemplateLanguage.assertRequiredAnnotationTypes(sent,srlFePrm.fePrm.soloTemplates);
    TemplateLanguage.assertRequiredAnnotationTypes(sent,srlFePrm.fePrm.pairTemplates);
  }
  log.info("String_Node_Str");
  SrlFgExampleBuilderPrm prm=getSrlFgExampleBuilderPrm(srlFePrm);
  SrlFgExamplesBuilder builder=new SrlFgExamplesBuilder(prm,ofc,cs);
  FgExampleList data=builder.getData(sents);
  if (prm.fgPrm.predictSense) {
    fts.startGrowth();
    Var v=new Var(VarType.PREDICTED,1,CorpusStatistics.UNKNOWN_SENSE,CorpusStatistics.SENSES_FOR_UNK_PRED);
    fts.add(new FactorTemplate(new VarSet(v),new Alphabet<Feature>(),SrlFactorGraph.TEMPLATE_KEY_FOR_UNKNOWN_SENSE));
    fts.stopGrowth();
  }
  if (!ofc.isInitialized()) {
    log.info("String_Node_Str");
    ofc.init(data);
  }
  log.info(String.format("String_Node_Str",name,data.size()));
  log.info(String.format("String_Node_Str",fts.size()));
  log.info(String.format("String_Node_Str",fts.getNumObsFeats()));
  return data;
}

Fixed version (ground truth):
private FgExampleList getData(ObsFeatureConjoiner ofc,CorpusStatistics cs,String name,SimpleAnnoSentenceCollection sents,SrlFeatureExtractorPrm srlFePrm){
  if (!cs.isInitialized()) {
    log.info("String_Node_Str");
    cs.init(sents);
  }
  FactorTemplateList fts=ofc.getTemplates();
  if (useTemplates) {
    SimpleAnnoSentence sent=sents.get(0);
    TemplateLanguage.assertRequiredAnnotationTypes(sent,srlFePrm.fePrm.soloTemplates);
    TemplateLanguage.assertRequiredAnnotationTypes(sent,srlFePrm.fePrm.pairTemplates);
  }
  log.info("String_Node_Str");
  SrlFgExampleBuilderPrm prm=getSrlFgExampleBuilderPrm(srlFePrm);
  SrlFgExamplesBuilder builder=new SrlFgExamplesBuilder(prm,ofc,cs);
  FgExampleList data=builder.getData(sents);
  if (prm.fgPrm.predictSense && fts.isGrowing()) {
    Var v=new Var(VarType.PREDICTED,1,CorpusStatistics.UNKNOWN_SENSE,CorpusStatistics.SENSES_FOR_UNK_PRED);
    fts.add(new FactorTemplate(new VarSet(v),new Alphabet<Feature>(),SrlFactorGraph.TEMPLATE_KEY_FOR_UNKNOWN_SENSE));
  }
  if (!ofc.isInitialized()) {
    log.info("String_Node_Str");
    ofc.init(data);
  }
  log.info(String.format("String_Node_Str",name,data.size()));
  log.info(String.format("String_Node_Str",fts.size()));
  log.info(String.format("String_Node_Str",fts.getNumObsFeats()));
  return data;
}
Program: 131427
Project: 131427
Buggy source:
public void addFeatures(FeatTemplate tpl,int pidx,int cidx,List<String> feats){
  int idx=pidx;
  if (tpl instanceof FeatTemplate1) {
    addTokenFeature((FeatTemplate1)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate2) {
    addTokenFeatures((FeatTemplate2)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate3) {
    addListFeature((FeatTemplate3)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate4) {
    addOtherFeature((FeatTemplate4)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof BigramTemplate) {
    addBigramFeature((BigramTemplate)tpl,pidx,cidx,feats);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + tpl);
  }
}

Fixed version (ground truth):
public void addFeatures(FeatTemplate tpl,int pidx,int cidx,List<String> feats){
  int idx=pidx;
  if (tpl instanceof FeatTemplate1) {
    addTokenFeature((FeatTemplate1)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate2) {
    addTokenFeatures((FeatTemplate2)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate3) {
    addListFeature((FeatTemplate3)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate4) {
    addOtherFeature((FeatTemplate4)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof JoinTemplate) {
    addJoinFeature((JoinTemplate)tpl,pidx,cidx,feats);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + tpl);
  }
}
Program: 131428
Project: 131428
Buggy source:
@Test public void testBigramFeature(){
{
    FeatTemplate tpl1=new FeatTemplate1(Position.PARENT,PositionModifier.IDENTITY,TokProperty.MORPHO);
    String expected1="String_Node_Str";
    FeatTemplate tpl2=new FeatTemplate3(PositionList.LINE_P_C,TokProperty.POS,null,ListModifier.SEQ);
    String expected2="String_Node_Str";
    FeatTemplate tpl=new BigramTemplate(tpl1,tpl2);
    getFeatAndAssertEquality(tpl,expected1 + "String_Node_Str" + expected2);
  }
{
    FeatTemplate tpl1=new FeatTemplate2(Position.PARENT,PositionModifier.IDENTITY,TokPropList.EACH_MORPHO);
    String[] expected1=new String[]{"String_Node_Str","String_Node_Str"};
    FeatTemplate tpl2=new FeatTemplate3(PositionList.LINE_P_C,TokProperty.POS,null,ListModifier.SEQ);
    String expected2="String_Node_Str";
    FeatTemplate tpl=new BigramTemplate(tpl1,tpl2);
    String[] expected=new String[]{expected1[0] + "String_Node_Str" + expected2,expected1[1] + "String_Node_Str" + expected2};
    getFeatsAndAssertEquality(tpl,expected);
  }
}

Fixed version (ground truth):
@Test public void testBigramFeature(){
{
    FeatTemplate tpl1=new FeatTemplate1(Position.PARENT,PositionModifier.IDENTITY,TokProperty.MORPHO);
    String expected1="String_Node_Str";
    FeatTemplate tpl2=new FeatTemplate3(PositionList.LINE_P_C,TokProperty.POS,null,ListModifier.SEQ);
    String expected2="String_Node_Str";
    FeatTemplate tpl=new JoinTemplate(tpl1,tpl2);
    getFeatAndAssertEquality(tpl,expected1 + "String_Node_Str" + expected2);
  }
{
    FeatTemplate tpl1=new FeatTemplate2(Position.PARENT,PositionModifier.IDENTITY,TokPropList.EACH_MORPHO);
    String[] expected1=new String[]{"String_Node_Str","String_Node_Str"};
    FeatTemplate tpl2=new FeatTemplate3(PositionList.LINE_P_C,TokProperty.POS,null,ListModifier.SEQ);
    String expected2="String_Node_Str";
    FeatTemplate tpl=new JoinTemplate(tpl1,tpl2);
    String[] expected=new String[]{expected1[0] + "String_Node_Str" + expected2,expected1[1] + "String_Node_Str" + expected2};
    getFeatsAndAssertEquality(tpl,expected);
  }
}
Program: 131429
Project: 131429
Buggy source:
private void testPositionModifiersHelper(int pidx,PositionModifier mod,String expectedWord){
  FeatTemplate tpl=new FeatTemplate1(Position.PARENT,mod,TokProperty.WORD);
  TemplateFeatureExtractor extr=getCoNLLSentenceExtractor1();
  int cidx=-1;
  ArrayList<String> feats=new ArrayList<String>();
  extr.addFeatures(tpl,pidx,cidx,feats);
  for (  Object feat : feats) {
    System.out.println(feat);
  }
  assertEquals(feats.size(),1);
  assertEquals("String_Node_Str" + mod.name() + "String_Node_Str"+ expectedWord,feats.get(0));
}

Fixed version (ground truth):
private void testPositionModifiersHelper(int pidx,PositionModifier mod,String expectedWord){
  FeatTemplate tpl=new FeatTemplate1(Position.PARENT,mod,TokProperty.WORD);
  TemplateFeatureExtractor extr=getCoNLLSentenceExtractor1();
  int cidx=-1;
  ArrayList<String> feats=new ArrayList<String>();
  extr.addFeatures(tpl,pidx,cidx,feats);
  for (  Object feat : feats) {
    System.out.println(feat);
  }
  assertEquals(feats.size(),1);
  assertEquals(tpl.getName() + "String_Node_Str" + expectedWord,feats.get(0));
}
Program: 131430
Project: 131430
Buggy source:
public String getName(){
  return StringUtils.join(new String[]{tpl1.getName(),tpl2.getName()},"String_Node_Str" + TEMPLATE_SEP + "String_Node_Str");
}

Fixed version (ground truth):
public String getName(){
  if (name == null) {
    name=StringUtils.join(toNames(tpls),"String_Node_Str" + TEMPLATE_SEP + "String_Node_Str");
  }
  return name;
}
Program: 131431
Project: 131431
Buggy source:
public List<Enum<?>> getStructure(){
  List<Enum<?>> s=new ArrayList<Enum<?>>(tpl1.getStructure());
  s.addAll(tpl2.getStructure());
  return s;
}

Fixed version (ground truth):
public List<Enum<?>> getStructure(){
  List<Enum<?>> s=new ArrayList<Enum<?>>();
  for (  FeatTemplate tpl : tpls) {
    s.addAll(tpl.getStructure());
  }
  return s;
}
Program: 131432
Project: 131432
Buggy source:
public boolean isPath(){
switch (this) {
case LINE_P_C:
case CHILDREN_P:
case NO_FAR_CHILDREN_P:
case CHILDREN_C:
case NO_FAR_CHILDREN_C:
    return false;
default :
  return true;
}
}

Fixed version (ground truth):
public boolean isPath(){
switch (this) {
case PATH_P_C:
case PATH_P_LCA:
case PATH_C_LCA:
case PATH_LCA_ROOT:
    return true;
default :
  return false;
}
}
Program: 131433
Project: 131433
Buggy source:
@Test public void testGetAll(){
  List<FeatTemplate> tpls;
  tpls=TemplateSets.getAllUnigramFeatureTemplates();
  int numUnigrams=tpls.size();
  System.out.println("String_Node_Str" + numUnigrams);
  tpls=TemplateSets.getAllBigramFeatureTemplates();
  int numBigrams=tpls.size();
  System.out.println("String_Node_Str" + numBigrams);
  assertEquals(1166,numUnigrams);
  assertEquals(679195,numBigrams);
}

Fixed version (ground truth):
@Test public void testGetAll(){
  List<FeatTemplate> tpls;
  tpls=TemplateSets.getAllUnigramFeatureTemplates();
  int numUnigrams=tpls.size();
  System.out.println("String_Node_Str" + numUnigrams);
  tpls=TemplateSets.getAllBigramFeatureTemplates();
  int numBigrams=tpls.size();
  System.out.println("String_Node_Str" + numBigrams);
  assertEquals(1467,numUnigrams);
  assertEquals(1075311,numBigrams);
}
Program: 131434
Project: 131434
Buggy source:
@Test public void testGetCoarseUnigramSet1(){
  List<FeatTemplate> tpls;
  tpls=TemplateSets.getCoarseUnigramSet1();
  int numArg=tpls.size();
  System.out.println("String_Node_Str" + numArg);
  assertEquals(126,numArg);
  for (  FeatTemplate tpl : tpls) {
    System.out.println(tpl);
  }
}

Fixed version (ground truth):
@Test public void testGetCoarseUnigramSet1(){
  List<FeatTemplate> tpls;
  tpls=TemplateSets.getCoarseUnigramSet1();
  int numArg=tpls.size();
  System.out.println("String_Node_Str" + numArg);
  assertEquals(125,numArg);
  for (  FeatTemplate tpl : tpls) {
    System.out.println(tpl);
  }
}
Program: 131435
Project: 131435
Buggy source:
public static <T>void awaitAll(ExecutorService pool,List<Future<T>> futures){
  int count=0;
  try {
    boolean[] isDone=new boolean[futures.size()];
    Arrays.fill(isDone,false);
    int i=0;
    while (true) {
      if (count == futures.size()) {
        break;
      }
 else       if (isDone[i]) {
      }
 else {
        Future<T> f=futures.get(i);
        try {
          f.get(100,TimeUnit.MILLISECONDS);
          count++;
          isDone[i]=true;
        }
 catch (        InterruptedException e) {
          throw new RuntimeException(e);
        }
catch (        ExecutionException e) {
          throw new RuntimeException(e);
        }
catch (        TimeoutException e) {
        }
      }
      i=i + 1 % futures.size();
    }
  }
  finally {
    if (count != futures.size()) {
      for (      Future<T> f : futures) {
        boolean canceled=f.cancel(true);
      }
    }
  }
}

Fixed version (ground truth):
public static <T>void awaitAll(ExecutorService pool,List<Future<T>> futures){
  int count=0;
  try {
    boolean[] isDone=new boolean[futures.size()];
    Arrays.fill(isDone,false);
    int i=0;
    while (true) {
      if (count == futures.size()) {
        break;
      }
 else       if (isDone[i]) {
      }
 else {
        Future<T> f=futures.get(i);
        try {
          f.get(100,TimeUnit.MILLISECONDS);
          count++;
          isDone[i]=true;
        }
 catch (        InterruptedException e) {
          throw new RuntimeException(e);
        }
catch (        ExecutionException e) {
          throw new RuntimeException(e);
        }
catch (        TimeoutException e) {
        }
      }
      i=(i + 1) % futures.size();
    }
  }
  finally {
    if (count != futures.size()) {
      for (      Future<T> f : futures) {
        boolean canceled=f.cancel(true);
      }
    }
  }
}
Program: 131436
Project: 131436
Buggy source:
/** 
 * Prepends the string prefix to each feature in obsFeats, and adds each one to fv using the given alphabet.
 */
private void addFeatures(ArrayList<String> obsFeats,Alphabet<Feature> alphabet,String prefix,FeatureVector fv,boolean isBiasFeat){
  if (prm.featureHashMod <= 0) {
    for (    String obsFeat : obsFeats) {
      String fname=prefix + obsFeat;
      int fidx=alphabet.lookupIndex(new Feature(fname,isBiasFeat));
      if (fidx != -1) {
        fv.add(fidx,1.0);
      }
    }
  }
 else {
    for (    String obsFeat : obsFeats) {
      String fname=prefix + obsFeat;
      int hash=fname.hashCode();
      FastMath.mod(hash,prm.featureHashMod);
      fname=Integer.toString(hash);
      int fidx=alphabet.lookupIndex(new Feature(fname,isBiasFeat));
      if (fidx != -1) {
        int revHash=reverseHashCode(fname);
        if (revHash < 0) {
          fv.add(fidx,-1.0);
        }
 else {
          fv.add(fidx,1.0);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Prepends the string prefix to each feature in obsFeats, and adds each one to fv using the given alphabet.
 */
private void addFeatures(ArrayList<String> obsFeats,Alphabet<Feature> alphabet,String prefix,FeatureVector fv,boolean isBiasFeat){
  if (prm.featureHashMod <= 0) {
    for (    String obsFeat : obsFeats) {
      String fname=prefix + obsFeat;
      int fidx=alphabet.lookupIndex(new Feature(fname,isBiasFeat));
      if (fidx != -1) {
        fv.add(fidx,1.0);
      }
    }
  }
 else {
    for (    String obsFeat : obsFeats) {
      String fname=prefix + obsFeat;
      int hash=MurmurHash3.murmurhash3_x86_32(fname,0,fname.length(),123456789);
      hash=FastMath.mod(hash,prm.featureHashMod);
      int fidx=alphabet.lookupIndex(new Feature(hash,isBiasFeat));
      if (fidx != -1) {
        int revHash=reverseHashCode(fname);
        if (revHash < 0) {
          fv.add(fidx,-1.0);
        }
 else {
          fv.add(fidx,1.0);
        }
      }
    }
  }
}
Program: 131437
Project: 131437
Buggy source:
public FeaturizedTokenPair getFeatTokPair(int pidx,int cidx){
  if (pairs[pidx][cidx] == null) {
    pairs[pidx][cidx]=new FeaturizedTokenPair(pidx,cidx,getFeatTok(pidx),getFeatTok(cidx),sent);
  }
  return pairs[pidx][cidx];
}

Fixed version (ground truth):
public FeaturizedTokenPair getFeatTokPair(int pidx,int cidx){
  int p=convertToInternal(pidx);
  int c=convertToInternal(cidx);
  if (pairs[p][c] == null) {
    pairs[p][c]=new FeaturizedTokenPair(pidx,cidx,getFeatTok(pidx),getFeatTok(cidx),sent);
  }
  return pairs[p][c];
}
Program: 131438
Project: 131438
Buggy source:
public FeaturizedToken getFeatTok(int idx){
  if (idx < 0) {
    return featuredHeadDefault;
  }
 else   if (idx >= toks.length) {
    return featuredTailDefault;
  }
  if (toks[idx] == null) {
    this.toks[idx]=new FeaturizedToken(idx,sent,cs);
  }
  return toks[idx];
}

Fixed version (ground truth):
public FeaturizedToken getFeatTok(int idx){
  int i=convertToInternal(idx);
  if (toks[i] == null) {
    this.toks[i]=new FeaturizedToken(idx,sent,cs);
  }
  return toks[i];
}
Program: 131439
Project: 131439
Buggy source:
public FeaturizedSentence(SimpleAnnoSentence sent,CorpusStatistics cs){
  this.sent=sent;
  this.cs=cs;
  this.toks=new FeaturizedToken[sent.size()];
  this.pairs=new FeaturizedTokenPair[sent.size()][sent.size()];
  this.featuredHeadDefault=new FeaturizedToken(-1,sent,cs);
  this.featuredTailDefault=new FeaturizedToken(sent.size(),sent,cs);
}

Fixed version (ground truth):
public FeaturizedSentence(SimpleAnnoSentence sent,CorpusStatistics cs){
  this.sent=sent;
  this.cs=cs;
  int size=sent.size() + 2;
  this.toks=new FeaturizedToken[size];
  this.pairs=new FeaturizedTokenPair[size][size];
}
Program: 131440
Project: 131440
Buggy source:
public void clear(){
  obsFeatsSolo=new ArrayList[sentFeatExt.getSentSize()];
  obsFeatsPair=new ArrayList[sentFeatExt.getSentSize()][sentFeatExt.getSentSize()];
  obsSenseSolo=new ArrayList[sentFeatExt.getSentSize()];
}

Fixed version (ground truth):
public void clear(){
  obsFeatsSolo=new ArrayList[sentFeatExt.getSentSize()];
  obsFeatsPair=new ArrayList[sentFeatExt.getSentSize()][sentFeatExt.getSentSize()];
  obsFeatsPairForRoot=new ArrayList[sentFeatExt.getSentSize()];
}
Program: 131441
Project: 131441
Buggy source:
public ArrayList<String> fastGetObsFeats(int parent,int child){
  if (obsFeatsPair[parent][child] == null) {
    obsFeatsPair[parent][child]=sentFeatExt.createFeatureSet(parent,child);
  }
  return obsFeatsPair[parent][child];
}

Fixed version (ground truth):
public ArrayList<String> fastGetObsFeats(int parent,int child){
  if (parent == -1) {
    return fastGetObsFeatsForRoot(child);
  }
  if (obsFeatsPair[parent][child] == null) {
    obsFeatsPair[parent][child]=sentFeatExt.createFeatureSet(parent,child);
  }
  return obsFeatsPair[parent][child];
}
Program: 131442
Project: 131442
Buggy source:
@Test public void testGetAllUnigrams(){
  SimpleAnnoSentence sent=CoNLL09Sentence.toSimpleAnnoSentence(SimpleAnnoSentenceTest.getDogConll09Sentence(),true);
  addFakeBrownClusters(sent);
  CorpusStatistics cs=new CorpusStatistics(new CorpusStatisticsPrm());
  cs.init(Lists.getList(sent));
  TemplateFeatureExtractor extr=new TemplateFeatureExtractor(sent,cs);
  List<FeatTemplate> tpls=TemplateSets.getAllUnigramFeatureTemplates();
  int pidx=0;
  int cidx=3;
  ArrayList<String> feats=new ArrayList<String>();
  extr.addFeatures(tpls,pidx,cidx,feats);
  for (  Object feat : feats) {
    System.out.println(feat);
  }
}

Fixed version (ground truth):
@Test public void testGetAllUnigrams(){
  extractAllUnigramFeats(0,3);
}
Program: 131443
Project: 131443
Buggy source:
public void testZhaoFeatureBuilding() throws ParseException, IOException {
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  CorpusStatistics cs=new CorpusStatistics(csPrm);
  SentFeatureExtractorPrm fePrm=new SentFeatureExtractorPrm();
  fePrm.withSupervision=true;
  fePrm.useNaradFeats=false;
  fePrm.useLexicalDepPathFeats=false;
  fePrm.useSimpleFeats=false;
  fePrm.useZhaoFeats=true;
  File train=new File("String_Node_Str");
  CoNLL09FileReader reader=new CoNLL09FileReader(train);
  Timer timer=new Timer();
  timer.start();
  for (int n=0; n < 49; n++) {
    CoNLL09Sentence sent=reader.next();
    SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
    log.info("String_Node_Str");
    SentFeatureExtractor fe=new SentFeatureExtractor(fePrm,simpleSent,cs);
    log.info("String_Node_Str");
    for (int i=0; i < sent.size(); i++) {
      for (int j=0; j < sent.size(); j++) {
        fe.createFeatureSet(i,j);
      }
    }
    timer.split();
    log.info("String_Node_Str");
  }
  timer.stop();
  log.info("String_Node_Str" + timer.avgMs());
}

Fixed version (ground truth):
@Test public void testZhaoFeatureBuilding() throws ParseException, IOException {
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  CorpusStatistics cs=new CorpusStatistics(csPrm);
  SentFeatureExtractorPrm fePrm=new SentFeatureExtractorPrm();
  fePrm.withSupervision=true;
  fePrm.useNaradFeats=false;
  fePrm.useLexicalDepPathFeats=false;
  fePrm.useSimpleFeats=false;
  fePrm.useZhaoFeats=true;
  fePrm.useBjorkelundFeats=false;
  File train=new File("String_Node_Str");
  CoNLL09FileReader reader=new CoNLL09FileReader(train);
  Timer timer=new Timer();
  timer.start();
  for (int n=0; n < 49; n++) {
    CoNLL09Sentence sent=reader.next();
    SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
    log.info("String_Node_Str");
    SentFeatureExtractor fe=new SentFeatureExtractor(fePrm,simpleSent,cs);
    log.info("String_Node_Str");
    for (int i=-1; i < sent.size(); i++) {
      for (int j=0; j < sent.size(); j++) {
        fe.createFeatureSet(i,j);
      }
    }
    timer.split();
    log.info("String_Node_Str");
  }
  timer.stop();
  log.info("String_Node_Str" + timer.avgMs());
}
Program: 131445
Project: 131445
Buggy source:
public void addFeatures(FeatTemplate tpl,int pidx,int cidx,List<Object> feats){
  int idx=pidx;
  if (tpl instanceof FeatTemplate1) {
    addTokenFeature((FeatTemplate1)tpl,idx,feats);
  }
 else   if (tpl instanceof FeatTemplate2) {
    addTokenFeatures((FeatTemplate2)tpl,idx,feats);
  }
 else   if (tpl instanceof FeatTemplate3) {
    addListFeature((FeatTemplate3)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate4) {
    addOtherFeature((FeatTemplate4)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof BigramTemplate) {
    addBigramFeature((BigramTemplate)tpl,pidx,cidx,feats);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + tpl);
  }
}

Fixed version (ground truth):
public void addFeatures(FeatTemplate tpl,int pidx,int cidx,List<Object> feats){
  int idx=pidx;
  if (tpl instanceof FeatTemplate1) {
    addTokenFeature((FeatTemplate1)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate2) {
    addTokenFeatures((FeatTemplate2)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate3) {
    addListFeature((FeatTemplate3)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof FeatTemplate4) {
    addOtherFeature((FeatTemplate4)tpl,pidx,cidx,feats);
  }
 else   if (tpl instanceof BigramTemplate) {
    addBigramFeature((BigramTemplate)tpl,pidx,cidx,feats);
  }
 else {
    throw new IllegalStateException("String_Node_Str" + tpl);
  }
}
Program: 131446
Project: 131446
Buggy source:
/** 
 * Adds features of the form:  p.bc1 c_{head}.dr first(t, NOUN, path(p, root)).bc0
 * @param tpl Structured feature template.
 * @param idx Token to which the original position refers.
 * @param feats The feature list to which this will be added.
 */
public void addTokenFeature(FeatTemplate1 tpl,int idx,List<Object> feats){
  Position pos=tpl.pos;
  PositionModifier mod=tpl.mod;
  TokProperty prop=tpl.prop;
  idx=getModifiedPosition(mod,idx);
  String val=getTokProp(prop,idx);
  if (val != null) {
    Object feat=toFeat(tpl.getName(),val);
    feats.add(feat);
  }
}

Fixed version (ground truth):
/** 
 * Adds features of the form:  p.bc1 c_{head}.dr first(t, NOUN, path(p, root)).bc0
 * @param tpl Structured feature template.
 * @param pidx Token to which the parent position refers.
 * @param cidx Token to which the child position refers.
 * @param feats The feature list to which this will be added.
 */
public void addTokenFeature(FeatTemplate1 tpl,int pidx,int cidx,List<Object> feats){
  Position pos=tpl.pos;
  PositionModifier mod=tpl.mod;
  TokProperty prop=tpl.prop;
  int idx=getIndexOfPosition(pidx,cidx,pos);
  idx=getModifiedPosition(mod,idx);
  String val=getTokProp(prop,idx);
  if (val != null) {
    Object feat=toFeat(tpl.getName(),val);
    feats.add(feat);
  }
}
Program: 131447
Project: 131447
Buggy source:
/** 
 * Same as above except that it permits properties of the token which expand to multiple strings. 
 */
public void addTokenFeatures(FeatTemplate2 tpl,int idx,List<Object> feats){
  Position pos=tpl.pos;
  PositionModifier mod=tpl.mod;
  TokPropList prop=tpl.prop;
  idx=getModifiedPosition(mod,idx);
  List<String> vals=getTokPropList(prop,idx);
  for (  String val : vals) {
    feats.add(toFeat(tpl.getName(),val));
  }
}

Fixed version (ground truth):
/** 
 * Same as above except that it permits properties of the token which expand to multiple strings. 
 */
public void addTokenFeatures(FeatTemplate2 tpl,int pidx,int cidx,List<Object> feats){
  Position pos=tpl.pos;
  PositionModifier mod=tpl.mod;
  TokPropList prop=tpl.prop;
  int idx=getIndexOfPosition(pidx,cidx,pos);
  idx=getModifiedPosition(mod,idx);
  List<String> vals=getTokPropList(prop,idx);
  for (  String val : vals) {
    feats.add(toFeat(tpl.getName(),val));
  }
}
Program: 131448
Project: 131448
Buggy source:
public String getGeneologicalRelation(){
  if (pidx == aidx) {
    return "String_Node_Str";
  }
 else   if (pidx == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (pidx == -1) {
    return "String_Node_Str";
  }
 else   if (aidx == -1) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == aidx) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(pidx,aidx,parents)) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(aidx,pidx,parents)) {
    return "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String getGeneologicalRelation(){
  if (pidx == aidx) {
    return "String_Node_Str";
  }
 else   if (hasParent(aidx) && pidx == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (hasParent(pidx) && parents[pidx] == aidx) {
    return "String_Node_Str";
  }
 else   if (hasParent(aidx) && hasParent(pidx) && parents[pidx] == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (pidx == -1) {
    return "String_Node_Str";
  }
 else   if (aidx == -1) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(pidx,aidx,parents)) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(aidx,pidx,parents)) {
    return "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}
Program: 131449
Project: 131449
Buggy source:
private void ensureChildren(){
  if (children != null) {
    return;
  }
  if (idx < 0 || idx >= sent.size()) {
    this.children=new ArrayList<Integer>();
    this.children.add(-1);
  }
 else {
    this.children=DepTree.getChildrenOf(parents,idx);
  }
}

Fixed version (ground truth):
private void ensureChildren(){
  if (children != null) {
    return;
  }
  this.children=DepTree.getChildrenOf(parents,idx);
}
Program: 131450
Project: 131450
Buggy source:
private void cacheNoFarChildren(){
  this.noFarChildren=new ArrayList<Integer>();
  this.noFarChildren.add(nearLeftChild);
  this.noFarChildren.add(nearRightChild);
}

Fixed version (ground truth):
private void cacheNoFarChildren(){
  ensureChildren();
  this.noFarChildren=new ArrayList<Integer>();
  for (int i=0; i < children.size(); i++) {
    int child=children.get(i);
    if (child < idx && i == 0) {
      continue;
    }
 else     if (child > idx && i == children.size() - 1) {
      continue;
    }
    this.noFarChildren.add(child);
  }
}
Program: 131451
Project: 131451
Buggy source:
@Test public void testZhaoObjectParentsChildrenSentence2(){
  CoNLL09Sentence sent=getSpanishConll09Sentence2();
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
  CorpusStatistics cs=new CorpusStatistics(csPrm);
  cs.init(Lists.getList(simpleSent));
  FeaturizedToken zhaoObj=new FeaturizedToken(3,simpleSent,cs);
  assertEquals(zhaoObj.getParent(),5);
  assertEquals(zhaoObj.getChildren(),new ArrayList<Integer>());
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarRightChild(),-2);
  assertEquals(zhaoObj.getNearLeftChild(),-2);
  assertEquals(zhaoObj.getNearRightChild(),-2);
  assertEquals(zhaoObj.getHighSupportNoun(),-1);
  assertEquals(zhaoObj.getLowSupportNoun(),-1);
  assertEquals(zhaoObj.getHighSupportVerb(),1);
  assertEquals(zhaoObj.getLowSupportVerb(),5);
  ArrayList<Integer> expectedNoFarChildren=new ArrayList<Integer>();
  expectedNoFarChildren.add(-2);
  expectedNoFarChildren.add(-2);
  assertEquals(zhaoObj.getNoFarChildren(),expectedNoFarChildren);
}

Fixed version (ground truth):
@Test public void testZhaoObjectParentsChildrenSentence2(){
  CoNLL09Sentence sent=getSpanishConll09Sentence2();
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
  CorpusStatistics cs=new CorpusStatistics(csPrm);
  cs.init(Lists.getList(simpleSent));
  FeaturizedToken zhaoObj=new FeaturizedToken(3,simpleSent,cs);
  assertEquals(zhaoObj.getParent(),5);
  assertEquals(zhaoObj.getChildren(),new ArrayList<Integer>());
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarRightChild(),-2);
  assertEquals(zhaoObj.getNearLeftChild(),-2);
  assertEquals(zhaoObj.getNearRightChild(),-2);
  assertEquals(zhaoObj.getHighSupportNoun(),-1);
  assertEquals(zhaoObj.getLowSupportNoun(),-1);
  assertEquals(zhaoObj.getHighSupportVerb(),1);
  assertEquals(zhaoObj.getLowSupportVerb(),5);
  ArrayList<Integer> expectedNoFarChildren=new ArrayList<Integer>();
  assertEquals(zhaoObj.getNoFarChildren(),expectedNoFarChildren);
}
Program: 131452
Project: 131452
Buggy source:
public String getGeneologicalRelation(){
  if (pidx == aidx) {
    return "String_Node_Str";
  }
 else   if (pidx == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == aidx) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(pidx,aidx,parents)) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(aidx,pidx,parents)) {
    return "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
public String getGeneologicalRelation(){
  if (pidx == aidx) {
    return "String_Node_Str";
  }
 else   if (pidx == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (pidx == -1) {
    return "String_Node_Str";
  }
 else   if (aidx == -1) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == aidx) {
    return "String_Node_Str";
  }
 else   if (parents[pidx] == parents[aidx]) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(pidx,aidx,parents)) {
    return "String_Node_Str";
  }
 else   if (DepTree.isAncestor(aidx,pidx,parents)) {
    return "String_Node_Str";
  }
 else {
    return "String_Node_Str";
  }
}
Program: 131453
Project: 131453
Buggy source:
public void shutdown(){
  pool.shutdown();
  try {
    pool.awaitTermination(10,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void shutdown(){
  Threads.shutdownSafelyOrDie(pool);
}
Program: 131454
Project: 131454
Buggy source:
public void shutdown(){
  pool.shutdown();
  try {
    pool.awaitTermination(10,TimeUnit.SECONDS);
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public void shutdown(){
  Threads.shutdownSafelyOrDie(pool);
}
Program: 131455
Project: 131455
Buggy source:
public static void main(String[] args) throws IOException {
  ArgParser parser=new ArgParser(SrlRunner.class);
  parser.addClass(SrlRunner.class);
  try {
    parser.parseArgs(args);
  }
 catch (  ParseException e) {
    log.error(e.getMessage());
    parser.printUsage();
    System.exit(1);
  }
  Prng.seed(seed);
  SrlRunner pipeline=new SrlRunner();
  try {
    pipeline.run();
  }
 catch (  ParseException e1) {
    log.error(e1.getMessage());
    parser.printUsage();
    System.exit(1);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    ArgParser parser=new ArgParser(SrlRunner.class);
    parser.addClass(SrlRunner.class);
    try {
      parser.parseArgs(args);
    }
 catch (    ParseException e) {
      log.error(e.getMessage());
      parser.printUsage();
      System.exit(1);
    }
    Prng.seed(seed);
    SrlRunner pipeline=new SrlRunner();
    try {
      pipeline.run();
    }
 catch (    ParseException e1) {
      log.error(e1.getMessage());
      parser.printUsage();
      System.exit(1);
    }
  }
 catch (  Throwable t) {
    t.printStackTrace();
    System.exit(1);
  }
  System.exit(0);
}
Program: 131456
Project: 131456
Buggy source:
public static <T>void awaitAll(List<Future<T>> futures){
  for (  Future<T> f : futures) {
    try {
      f.get();
    }
 catch (    InterruptedException e) {
      throw new RuntimeException(e);
    }
catch (    ExecutionException e) {
      throw new RuntimeException(e);
    }
  }
}

Fixed version (ground truth):
public static <T>void awaitAll(ExecutorService pool,List<Future<T>> futures){
  int count=0;
  try {
    boolean[] isDone=new boolean[futures.size()];
    Arrays.fill(isDone,false);
    int i=0;
    while (true) {
      if (count == futures.size()) {
        break;
      }
 else       if (isDone[i]) {
      }
 else {
        Future<T> f=futures.get(i);
        try {
          f.get(100,TimeUnit.MILLISECONDS);
          count++;
          isDone[i]=true;
        }
 catch (        InterruptedException e) {
          shutdownSafelyOrDie(pool);
          throw new RuntimeException(e);
        }
catch (        ExecutionException e) {
          shutdownSafelyOrDie(pool);
          throw new RuntimeException(e);
        }
catch (        TimeoutException e) {
        }
      }
      i=i + 1 % futures.size();
    }
  }
  finally {
    if (count != futures.size()) {
      for (      Future<T> f : futures) {
        boolean canceled=f.cancel(true);
        log.error("String_Node_Str" + canceled);
      }
    }
  }
}
Program: 131457
Project: 131457
Buggy source:
public static <T>void addAllResults(ExecutorService pool,ArrayList<Callable<T>> tasks,List<T> results){
  try {
    List<Future<T>> futures=pool.invokeAll(tasks);
    for (    Future<T> f : futures) {
      results.add(f.get());
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static <T>void addAllResults(ExecutorService pool,ArrayList<Callable<T>> tasks,List<T> results){
  try {
    List<Future<T>> futures=invokeAndAwaitAll(pool,tasks);
    for (    Future<T> f : futures) {
      results.add(f.get());
    }
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    throw new RuntimeException(e);
  }
}
Program: 131458
Project: 131458
Buggy source:
public static void invokeAndAwaitAll(ExecutorService pool,List<Callable<Object>> tasks){
  try {
    awaitAll(pool.invokeAll(tasks));
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static <T>List<Future<T>> invokeAndAwaitAll(ExecutorService pool,List<Callable<T>> tasks){
  List<Future<T>> futures=executeAll(pool,tasks);
  awaitAll(pool,futures);
  return futures;
}
Program: 131459
Project: 131459
Buggy source:
public static <T>List<T> getAllResults(ExecutorService pool,ArrayList<Callable<T>> tasks){
  try {
    List<T> results=new ArrayList<T>();
    List<Future<T>> futures=pool.invokeAll(tasks);
    for (    Future<T> f : futures) {
      results.add(f.get());
    }
    return results;
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
public static <T>List<T> getAllResults(ExecutorService pool,ArrayList<Callable<T>> tasks){
  try {
    List<T> results=new ArrayList<T>();
    List<Future<T>> futures=invokeAndAwaitAll(pool,tasks);
    for (    Future<T> f : futures) {
      results.add(f.get());
    }
    return results;
  }
 catch (  InterruptedException e) {
    throw new RuntimeException(e);
  }
catch (  ExecutionException e) {
    throw new RuntimeException(e);
  }
}
Program: 131460
Project: 131460
Buggy source:
@Override public Integer call() throws Exception {
  return i;
}

Fixed version (ground truth):
@Override public Object call() throws Exception {
  Thread.sleep(100);
  if (i == 3) {
    throw new OutOfMemoryError("String_Node_Str");
  }
 else {
    while (true) {
      Thread.sleep(1000);
    }
  }
}
Program: 131461
Project: 131461
Buggy source:
private void cacheLinePath(){
  this.linePath=new ArrayList<Integer>();
  int startIdx;
  int endIdx;
  if (pidx < aidx) {
    startIdx=pidx;
    endIdx=aidx;
  }
 else {
    startIdx=aidx;
    endIdx=pidx;
  }
  while (startIdx < endIdx) {
    this.linePath.add(startIdx);
    startIdx++;
  }
}

Fixed version (ground truth):
private void cacheLinePath(){
  this.linePath=new ArrayList<Integer>();
  if (pidx < aidx) {
    for (int i=pidx; i <= aidx; i++) {
      this.linePath.add(i);
    }
  }
 else {
    for (int i=pidx; i >= aidx; i--) {
      this.linePath.add(i);
    }
  }
}
Program: 131462
Project: 131462
Buggy source:
public FeaturizedToken getFeatTok(int idx){
  if (idx < 0) {
    return featuredHeadDefault;
  }
 else   if (idx >= toks.length) {
    return featuredTailDefault;
  }
  if (toks[idx] == null) {
    this.toks[idx]=new FeaturizedToken(idx,sent);
  }
  return toks[idx];
}

Fixed version (ground truth):
public FeaturizedToken getFeatTok(int idx){
  if (idx < 0) {
    return featuredHeadDefault;
  }
 else   if (idx >= toks.length) {
    return featuredTailDefault;
  }
  if (toks[idx] == null) {
    this.toks[idx]=new FeaturizedToken(idx,sent,cs);
  }
  return toks[idx];
}
Program: 131463
Project: 131463
Buggy source:
public FeaturizedSentence(SimpleAnnoSentence sent){
  this.sent=sent;
  int[] parents=sent.getParents();
  this.toks=new FeaturizedToken[sent.size()];
  this.pairs=new FeaturizedTokenPair[sent.size()][sent.size()];
  this.featuredHeadDefault=new FeaturizedToken(-1,sent);
  this.featuredTailDefault=new FeaturizedToken(sent.size(),sent);
}

Fixed version (ground truth):
public FeaturizedSentence(SimpleAnnoSentence sent,CorpusStatistics cs){
  this.sent=sent;
  this.cs=cs;
  this.toks=new FeaturizedToken[sent.size()];
  this.pairs=new FeaturizedTokenPair[sent.size()][sent.size()];
  this.featuredHeadDefault=new FeaturizedToken(-1,sent,cs);
  this.featuredTailDefault=new FeaturizedToken(sent.size(),sent,cs);
}
Program: 131464
Project: 131464
Buggy source:
private void ensureHighLowSupport(){
  if (cachedSupports) {
    return;
  }
  ensureRootPath();
  String parentPos;
  boolean haveArgLow=false;
  boolean havePredLow=false;
  int i;
  String supportNounTag="String_Node_Str";
  String supportVerbTag="String_Node_Str";
  this.lowSupportNoun=-1;
  this.highSupportNoun=-1;
  this.lowSupportVerb=-1;
  this.highSupportVerb=-1;
  for (  Pair<Integer,Dir> a : rootPath) {
    i=a.get1();
    if (i == -1) {
      break;
    }
    parentPos=sent.getPosTag(i);
    if (parentPos.equals(supportNounTag)) {
      if (!haveArgLow) {
        haveArgLow=true;
        this.lowSupportNoun=i;
        this.highSupportNoun=i;
      }
 else {
        this.highSupportNoun=i;
      }
    }
 else     if (parentPos.equals(supportVerbTag)) {
      if (!havePredLow) {
        havePredLow=true;
        this.lowSupportVerb=i;
        this.highSupportVerb=i;
      }
 else {
        this.highSupportVerb=i;
      }
    }
  }
  cachedSupports=true;
}

Fixed version (ground truth):
private void ensureHighLowSupport(){
  if (cachedSupports) {
    return;
  }
  if (cs == null) {
    throw new IllegalStateException("String_Node_Str" + "String_Node_Str");
  }
  ensureRootPath();
  String parentPos;
  boolean haveArgLow=false;
  boolean havePredLow=false;
  int i;
  this.lowSupportNoun=-1;
  this.highSupportNoun=-1;
  this.lowSupportVerb=-1;
  this.highSupportVerb=-1;
  for (  Pair<Integer,Dir> a : rootPath) {
    i=a.get1();
    if (i == -1) {
      break;
    }
    parentPos=sent.getPosTag(i);
    if (LanguageConstants.isNoun(parentPos,cs.getLanguage())) {
      if (!haveArgLow) {
        haveArgLow=true;
        this.lowSupportNoun=i;
        this.highSupportNoun=i;
      }
 else {
        this.highSupportNoun=i;
      }
    }
 else     if (LanguageConstants.isVerb(parentPos,cs.getLanguage())) {
      if (!havePredLow) {
        havePredLow=true;
        this.lowSupportVerb=i;
        this.highSupportVerb=i;
      }
 else {
        this.highSupportVerb=i;
      }
    }
  }
  cachedSupports=true;
}
Program: 131465
Project: 131465
Buggy source:
public FeaturizedToken(int idx,SimpleAnnoSentence sent){
  this.idx=idx;
  this.sent=sent;
  this.parents=sent.getParents();
  this.nearLeftSibling=-1;
  this.nearRightSibling=sent.size();
}

Fixed version (ground truth):
public FeaturizedToken(int idx,SimpleAnnoSentence sent,CorpusStatistics cs){
  this.idx=idx;
  this.sent=sent;
  this.parents=sent.getParents();
  this.nearLeftSibling=-1;
  this.nearRightSibling=sent.size();
  this.cs=cs;
}
Program: 131466
Project: 131466
Buggy source:
@Test public void testZhaoObjectParentsChildrenSentence2(){
  CoNLL09Sentence sent=getSpanishConll09Sentence2();
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
  FeaturizedToken zhaoObj=new FeaturizedToken(3,simpleSent);
  assertEquals(zhaoObj.getParent(),5);
  assertEquals(zhaoObj.getChildren(),new ArrayList<Integer>());
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarRightChild(),-2);
  assertEquals(zhaoObj.getNearLeftChild(),-2);
  assertEquals(zhaoObj.getNearRightChild(),-2);
  assertEquals(zhaoObj.getHighSupportNoun(),-1);
  assertEquals(zhaoObj.getLowSupportNoun(),-1);
  assertEquals(zhaoObj.getHighSupportVerb(),1);
  assertEquals(zhaoObj.getLowSupportVerb(),5);
  ArrayList<Integer> expectedNoFarChildren=new ArrayList<Integer>();
  expectedNoFarChildren.add(-2);
  expectedNoFarChildren.add(-2);
  assertEquals(zhaoObj.getNoFarChildren(),expectedNoFarChildren);
}

Fixed version (ground truth):
@Test public void testZhaoObjectParentsChildrenSentence2(){
  CoNLL09Sentence sent=getSpanishConll09Sentence2();
  CorpusStatisticsPrm csPrm=new CorpusStatisticsPrm();
  csPrm.useGoldSyntax=true;
  SimpleAnnoSentence simpleSent=sent.toSimpleAnnoSentence(csPrm.useGoldSyntax);
  CorpusStatistics cs=new CorpusStatistics(csPrm);
  cs.init(Lists.getList(simpleSent));
  FeaturizedToken zhaoObj=new FeaturizedToken(3,simpleSent,cs);
  assertEquals(zhaoObj.getParent(),5);
  assertEquals(zhaoObj.getChildren(),new ArrayList<Integer>());
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarLeftChild(),-2);
  assertEquals(zhaoObj.getFarRightChild(),-2);
  assertEquals(zhaoObj.getNearLeftChild(),-2);
  assertEquals(zhaoObj.getNearRightChild(),-2);
  assertEquals(zhaoObj.getHighSupportNoun(),-1);
  assertEquals(zhaoObj.getLowSupportNoun(),-1);
  assertEquals(zhaoObj.getHighSupportVerb(),1);
  assertEquals(zhaoObj.getLowSupportVerb(),5);
  ArrayList<Integer> expectedNoFarChildren=new ArrayList<Integer>();
  expectedNoFarChildren.add(-2);
  expectedNoFarChildren.add(-2);
  assertEquals(zhaoObj.getNoFarChildren(),expectedNoFarChildren);
}
Program: 131467
Project: 131467
Buggy source:
public SentFeatureExtractor(SentFeatureExtractorPrm prm,SimpleAnnoSentence sent,CorpusStatistics cs){
  this.prm=prm;
  this.sent=sent;
  this.cs=cs;
  this.sig=cs.sig;
  if (!prm.biasOnly) {
    this.parents=getParents(sent);
    if (prm.useZhaoFeats || prm.useDepPathFeats || prm.useBjorkelundFeats) {
      fSent=new FeaturizedSentence(sent);
    }
    if (prm.useAllTemplates) {
      this.prm.formFeats=true;
      this.prm.lemmaFeats=true;
      this.prm.tagFeats=true;
      this.prm.morphFeats=true;
      this.prm.deprelFeats=true;
      this.prm.childrenFeats=true;
      this.prm.pathFeats=true;
      this.prm.syntacticConnectionFeats=true;
    }
  }
 else {
    this.parents=null;
  }
}

Fixed version (ground truth):
public SentFeatureExtractor(SentFeatureExtractorPrm prm,SimpleAnnoSentence sent,CorpusStatistics cs){
  this.prm=prm;
  this.sent=sent;
  this.cs=cs;
  this.sig=cs.sig;
  if (!prm.biasOnly) {
    this.parents=getParents(sent);
    if (prm.useZhaoFeats || prm.useDepPathFeats || prm.useBjorkelundFeats) {
      fSent=new FeaturizedSentence(sent,cs);
    }
    if (prm.useAllTemplates) {
      this.prm.formFeats=true;
      this.prm.lemmaFeats=true;
      this.prm.tagFeats=true;
      this.prm.morphFeats=true;
      this.prm.deprelFeats=true;
      this.prm.childrenFeats=true;
      this.prm.pathFeats=true;
      this.prm.syntacticConnectionFeats=true;
    }
  }
 else {
    this.parents=null;
  }
}
Program: 131468
Project: 131468
Buggy source:
public TemplateLanguageExtractor(SimpleAnnoSentence sent,CorpusStatistics cs){
  this.sig=cs.sig;
  this.fSent=new FeaturizedSentence(sent);
}

Fixed version (ground truth):
public TemplateLanguageExtractor(SimpleAnnoSentence sent,CorpusStatistics cs){
  this.sig=cs.sig;
  this.fSent=new FeaturizedSentence(sent,cs);
}
Program: 131471
Project: 131471
Buggy source:
/** 
 * Gets the highest probability tree with the span (start, end) and the root symbol rootSymbol.
 * @param start The start of the span of the requested tree.
 * @param end The end of the span of the requested tree.
 * @param rootSymbol The symbol of the root of the requested tree.
 * @return 
 */
private BinaryTree getViterbiTree(int start,int end,int rootSymbol){
  ChartCell cell=chart[start][end];
  BackPointer bp=cell.getBp(rootSymbol);
  if (bp == null) {
    return null;
  }
  BinaryTree leftChild;
  BinaryTree rightChild;
  if (bp.r.isLexical()) {
    leftChild=new BinaryTree(bp.r.getLeftChild(),start,end,null,null,true,grammar.getLexAlphabet());
    rightChild=null;
  }
 else   if (bp.r.isUnary()) {
    leftChild=getViterbiTree(start,bp.mid,bp.r.getLeftChild());
    rightChild=null;
  }
 else {
    leftChild=getViterbiTree(start,bp.mid,bp.r.getLeftChild());
    rightChild=getViterbiTree(bp.mid,end,bp.r.getRightChild());
  }
  return new BinaryTree(rootSymbol,start,end,leftChild,rightChild,false,grammar.getNtAlphabet());
}

Fixed version (ground truth):
/** 
 * Gets the highest probability tree with the span (start, end) and the root symbol rootSymbol.
 * @param start The start of the span of the requested tree.
 * @param end The end of the span of the requested tree.
 * @param rootSymbol The symbol of the root of the requested tree.
 * @return The highest probability tree or null if no parse exists.
 */
private BinaryTree getViterbiTree(int start,int end,int rootSymbol){
  ChartCell cell=chart[start][end];
  BackPointer bp=cell.getBp(rootSymbol);
  if (bp == null) {
    return null;
  }
  BinaryTree leftChild;
  BinaryTree rightChild;
  if (bp.r.isLexical()) {
    leftChild=new BinaryTree(bp.r.getLeftChild(),start,end,null,null,true,grammar.getLexAlphabet());
    rightChild=null;
  }
 else   if (bp.r.isUnary()) {
    leftChild=getViterbiTree(start,bp.mid,bp.r.getLeftChild());
    rightChild=null;
  }
 else {
    leftChild=getViterbiTree(start,bp.mid,bp.r.getLeftChild());
    rightChild=getViterbiTree(bp.mid,end,bp.r.getRightChild());
  }
  return new BinaryTree(rootSymbol,start,end,leftChild,rightChild,false,grammar.getNtAlphabet());
}
Program: 131472
Project: 131472
Buggy source:
public List<CoNLL09Sentence> readSents(int maxSents,int maxSentLen){
  ArrayList<CoNLL09Sentence> sents=new ArrayList<CoNLL09Sentence>();
  for (  CoNLL09Sentence sent : this) {
    if (sents.size() > maxSents) {
      break;
    }
    if (sent.size() > maxSentLen) {
      continue;
    }
    sents.add(sent);
  }
  return sents;
}

Fixed version (ground truth):
public List<CoNLL09Sentence> readSents(int maxSents,int maxSentLen){
  ArrayList<CoNLL09Sentence> sents=new ArrayList<CoNLL09Sentence>();
  for (  CoNLL09Sentence sent : this) {
    if (sents.size() >= maxSents) {
      break;
    }
    if (sent.size() >= maxSentLen) {
      continue;
    }
    sents.add(sent);
  }
  return sents;
}