Program: 154158
Project: 154158
Buggy source:
private void addChildren(OBOClass sourceParent,Term targetParent,TaxonStore target,String prefix){
  final Collection<Link> childLinks=sourceParent.getChildren();
  for (  Link l : childLinks) {
    OBOProperty lType=l.getType();
    if (OBOUtils.ISA_PROPERTY.equals(lType.getID())) {
      OBOClass childClass=(OBOClass)l.getChild();
      Term childTerm=copyTerm(childClass,prefix);
      if (sourceUtils.getRankString(childClass) != null)       target.setRankFromName(childTerm,sourceUtils.getRankString(childClass));
      for (      Synonym syn : childClass.getSynonyms()) {
        if (syn.getSynonymType().equals(sourceUtils.getCommonNameType())) {
          if (!syn.getXrefs().isEmpty()) {
            final Dbxref ref=syn.getXrefs().iterator().next();
            SynonymI newSyn=target.makeCommonNameWithXref(syn.getText(),ref.getDatabase(),ref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
 else {
            SynonymI newSyn=target.makeCommonName(syn.getText());
            childTerm.addSynonym(newSyn);
          }
        }
 else {
          if (!syn.getXrefs().isEmpty()) {
            final Dbxref ref=syn.getXrefs().iterator().next();
            SynonymI newSyn=target.makeSynonymWithXref(syn.getText(),ref.getDatabase(),ref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
 else {
            SynonymI newSyn=target.makeSynonym(syn.getText());
            childTerm.addSynonym(newSyn);
          }
        }
      }
      target.attachParent(childTerm,targetParent);
      addChildren(childClass,childTerm,target,prefix);
    }
  }
}

Fixed version (ground truth):
private void addChildren(OBOClass sourceParent,Term targetParent,TaxonStore target,String prefix){
  final Collection<Link> childLinks=sourceParent.getChildren();
  for (  Link l : childLinks) {
    OBOProperty lType=l.getType();
    if (OBOUtils.ISA_PROPERTY.equals(lType.getID())) {
      OBOClass childClass=(OBOClass)l.getChild();
      Term childTerm=copyTerm(childClass,prefix);
      if (sourceUtils.getRankString(childClass) != null)       target.setRankFromName(childTerm,sourceUtils.getRankString(childClass));
      for (      Synonym syn : childClass.getSynonyms()) {
        if (sourceUtils.getCommonNameType().equals(syn.getSynonymType())) {
          if (!syn.getXrefs().isEmpty()) {
            final Dbxref ref=syn.getXrefs().iterator().next();
            SynonymI newSyn=target.makeCommonNameWithXref(syn.getText(),ref.getDatabase(),ref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
 else {
            SynonymI newSyn=target.makeCommonName(syn.getText());
            childTerm.addSynonym(newSyn);
          }
        }
 else {
          if (!syn.getXrefs().isEmpty()) {
            final Dbxref ref=syn.getXrefs().iterator().next();
            SynonymI newSyn=target.makeSynonymWithXref(syn.getText(),ref.getDatabase(),ref.getDatabaseID());
            childTerm.addSynonym(newSyn);
          }
 else {
            SynonymI newSyn=target.makeSynonym(syn.getText());
            childTerm.addSynonym(newSyn);
          }
        }
      }
      target.attachParent(childTerm,targetParent);
      addChildren(childClass,childTerm,target,prefix);
    }
  }
}