Program: 131188
Project: 131188
Buggy source:
public void init(FgExampleList data){
  if (templates.isGrowing() && data != null) {
    log.info("String_Node_Str");
    extractAllFeats(data,templates);
    templates.stopGrowth();
    feAlphabet.stopGrowth();
  }
  numTemplates=templates.size();
  this.included=new boolean[numTemplates][][];
  for (int t=0; t < numTemplates; t++) {
    FactorTemplate template=templates.get(t);
    int numConfigs=template.getNumConfigs();
    int numFeats=template.getAlphabet().size();
    included[t]=new boolean[numConfigs][numFeats];
  }
  BoolArrays.fill(included,true);
  if (!prm.includeUnsupportedFeatures) {
    prm.featCountCutoff=Math.max(prm.featCountCutoff,1);
  }
  if (prm.featCountCutoff >= 1) {
    log.info("String_Node_Str" + prm.featCountCutoff);
    IntIntDenseVector[][] counts=countFeatures(data,templates);
    excludeByFeatCount(counts);
  }
  for (int t=0; t < included.length; t++) {
    FactorTemplate template=templates.get(t);
    FeatureNames alphabet=template.getAlphabet();
    for (int k=0; k < alphabet.size(); k++) {
      if (alphabet.isBiasFeature(k)) {
        for (int c=0; c < included[t].length; c++) {
          included[t][c][k]=true;
        }
      }
    }
  }
  numParams=feAlphabet.size();
  this.indices=new int[numTemplates][][];
  for (int t=0; t < indices.length; t++) {
    FactorTemplate template=templates.get(t);
    int numConfigs=template.getNumConfigs();
    int numFeats=template.getAlphabet().size();
    indices[t]=new int[numConfigs][numFeats];
    for (int c=0; c < indices[t].length; c++) {
      for (int k=0; k < indices[t][c].length; k++) {
        indices[t][c][k]=included[t][c][k] ? numParams++ : -1;
      }
    }
  }
  numParams=Math.max(numParams,featureHashModMax);
  initialized=true;
}

Fixed version (ground truth):
/** 
 * The case of data == null should only be allowed in testing. 
 */
public void init(FgExampleList data){
  if (data == null && !prm.includeUnsupportedFeatures) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (data == null && prm.featCountCutoff > 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (templates.isGrowing() && data != null) {
    log.info("String_Node_Str");
    extractAllFeats(data,templates);
    templates.stopGrowth();
    feAlphabet.stopGrowth();
  }
  numTemplates=templates.size();
  this.included=new boolean[numTemplates][][];
  for (int t=0; t < numTemplates; t++) {
    FactorTemplate template=templates.get(t);
    int numConfigs=template.getNumConfigs();
    int numFeats=template.getAlphabet().size();
    included[t]=new boolean[numConfigs][numFeats];
  }
  BoolArrays.fill(included,true);
  if (!prm.includeUnsupportedFeatures) {
    prm.featCountCutoff=Math.max(prm.featCountCutoff,1);
  }
  if (prm.featCountCutoff >= 1) {
    log.info("String_Node_Str" + prm.featCountCutoff);
    IntIntDenseVector[][] counts=countFeatures(data,templates);
    excludeByFeatCount(counts);
  }
  for (int t=0; t < included.length; t++) {
    FactorTemplate template=templates.get(t);
    FeatureNames alphabet=template.getAlphabet();
    for (int k=0; k < alphabet.size(); k++) {
      if (alphabet.isBiasFeature(k)) {
        for (int c=0; c < included[t].length; c++) {
          included[t][c][k]=true;
        }
      }
    }
  }
  numParams=feAlphabet.size();
  this.indices=new int[numTemplates][][];
  for (int t=0; t < indices.length; t++) {
    FactorTemplate template=templates.get(t);
    int numConfigs=template.getNumConfigs();
    int numFeats=template.getAlphabet().size();
    indices[t]=new int[numConfigs][numFeats];
    for (int c=0; c < indices[t].length; c++) {
      for (int k=0; k < indices[t][c].length; k++) {
        indices[t][c][k]=included[t][c][k] ? numParams++ : -1;
      }
    }
  }
  numParams=Math.max(numParams,featureHashModMax);
  initialized=true;
}