Program: 131529
Project: 131529
Buggy source:
@Override public FeatureVector calcObsFeatureVector(int factorId){
  SrlFactor f=(SrlFactor)sfg.getFactor(factorId);
  SrlFactorTemplate ft=f.getFactorType();
  VarSet vars=f.getVars();
  BinaryStrFVBuilder obsFeats;
  Alphabet<Feature> alphabet;
  if (ft == SrlFactorTemplate.LINK_ROLE_BINARY || ft == SrlFactorTemplate.LINK_UNARY || ft == SrlFactorTemplate.ROLE_UNARY) {
    Var var=vars.iterator().next();
    int parent;
    int child;
    if (var instanceof LinkVar) {
      parent=((LinkVar)var).getParent();
      child=((LinkVar)var).getChild();
    }
 else {
      parent=((RoleVar)var).getParent();
      child=((RoleVar)var).getChild();
    }
    if (parent == -1) {
      obsFeats=fastGetObsFeats(child,obsAlphabet);
    }
 else {
      obsFeats=fastGetObsFeats(parent,child,obsAlphabet);
    }
    alphabet=fts.getTemplate(f).getAlphabet();
  }
 else {
    throw new RuntimeException("String_Node_Str" + ft);
  }
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + obsFeats.size());
  }
  FeatureVector fv=new FeatureVector(obsFeats.size());
  if (prm.featureHashMod <= 0) {
    int fidx=alphabet.lookupIndex(new Feature("String_Node_Str",true));
    if (fidx != -1) {
      fv.add(fidx,1.0);
    }
  }
 else {
    String fname="String_Node_Str";
    int hash=fname.hashCode();
    hash=hash % prm.featureHashMod;
    if (hash < 0) {
      hash+=prm.featureHashMod;
    }
    fname=Integer.toString(hash);
    int fidx=alphabet.lookupIndex(new Feature(fname,true));
    if (fidx != -1) {
      int revHash=reverseHashCode(fname);
      if (revHash < 0) {
        fv.add(fidx,-1.0);
      }
 else {
        fv.add(fidx,1.0);
      }
    }
  }
  if (prm.featureHashMod <= 0) {
    for (    String obsFeat : obsFeats) {
      int fidx=alphabet.lookupIndex(new Feature(obsFeat));
      if (fidx != -1) {
        fv.add(fidx,1.0);
      }
    }
  }
 else {
    FeatureVectorBuilder fvb=obsFeats.getFvb();
    for (    IntDoubleEntry obsFeat : fvb) {
      String fname=Integer.toString(obsFeat.index());
      int hash=fname.hashCode();
      hash=hash % prm.featureHashMod;
      if (hash < 0) {
        hash+=prm.featureHashMod;
      }
      fname=Integer.toString(hash);
      int fidx=alphabet.lookupIndex(new Feature(fname));
      if (fidx != -1) {
        int revHash=reverseHashCode(fname);
        if (revHash < 0) {
          fv.add(fidx,-1.0);
        }
 else {
          fv.add(fidx,1.0);
        }
      }
    }
  }
  return fv;
}

Fixed version (ground truth):
@Override public FeatureVector calcObsFeatureVector(int factorId){
  SrlFactor f=(SrlFactor)sfg.getFactor(factorId);
  SrlFactorTemplate ft=f.getFactorType();
  VarSet vars=f.getVars();
  BinaryStrFVBuilder obsFeats;
  Alphabet<Feature> alphabet;
  if (ft == SrlFactorTemplate.LINK_ROLE_BINARY || ft == SrlFactorTemplate.LINK_UNARY || ft == SrlFactorTemplate.ROLE_UNARY) {
    Var var=vars.iterator().next();
    int parent;
    int child;
    if (var instanceof LinkVar) {
      parent=((LinkVar)var).getParent();
      child=((LinkVar)var).getChild();
    }
 else {
      parent=((RoleVar)var).getParent();
      child=((RoleVar)var).getChild();
    }
    if (parent == -1) {
      obsFeats=fastGetObsFeats(child,obsAlphabet);
    }
 else {
      obsFeats=fastGetObsFeats(parent,child,obsAlphabet);
    }
    alphabet=fts.getTemplate(f).getAlphabet();
  }
 else {
    throw new RuntimeException("String_Node_Str" + ft);
  }
  String prefix=getObsVarsStates(f);
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + obsFeats.size());
  }
  FeatureVector fv=new FeatureVector(obsFeats.size());
  if (prm.featureHashMod <= 0) {
    int fidx=alphabet.lookupIndex(new Feature(prefix + "String_Node_Str",true));
    if (fidx != -1) {
      fv.add(fidx,1.0);
    }
  }
 else {
    String fname=prefix + "String_Node_Str";
    int hash=fname.hashCode();
    hash=hash % prm.featureHashMod;
    if (hash < 0) {
      hash+=prm.featureHashMod;
    }
    fname=Integer.toString(hash);
    int fidx=alphabet.lookupIndex(new Feature(fname,true));
    if (fidx != -1) {
      int revHash=reverseHashCode(fname);
      if (revHash < 0) {
        fv.add(fidx,-1.0);
      }
 else {
        fv.add(fidx,1.0);
      }
    }
  }
  if (prm.featureHashMod <= 0) {
    for (    String obsFeat : obsFeats) {
      String fname=prefix + "String_Node_Str" + obsFeat;
      int fidx=alphabet.lookupIndex(new Feature(fname));
      if (fidx != -1) {
        fv.add(fidx,1.0);
      }
    }
  }
 else {
    FeatureVectorBuilder fvb=obsFeats.getFvb();
    for (    IntDoubleEntry obsFeat : fvb) {
      String fname=prefix + "String_Node_Str" + Integer.toString(obsFeat.index());
      int hash=fname.hashCode();
      hash=hash % prm.featureHashMod;
      if (hash < 0) {
        hash+=prm.featureHashMod;
      }
      fname=Integer.toString(hash);
      int fidx=alphabet.lookupIndex(new Feature(fname));
      if (fidx != -1) {
        int revHash=reverseHashCode(fname);
        if (revHash < 0) {
          fv.add(fidx,-1.0);
        }
 else {
          fv.add(fidx,1.0);
        }
      }
    }
  }
  return fv;
}