Program: 125214
Project: 125214
Buggy source:
public List<Solution> inferSpeciesTree(){
  long startTime=System.currentTimeMillis();
  String[] gtTaxa;
  String[] stTaxa;
  Collapse.CollapseDescriptor cd=null;
  if ((trees == null) || (trees.size() == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (taxonNameMap != null && taxonNameMap.taxonMap != null) {
    Map<String,String> taxonMap=taxonNameMap.taxonMap;
    String error=Trees.checkMapping(trees,taxonMap);
    if (error != null) {
      throw new RuntimeException("String_Node_Str" + error + "String_Node_Str");
    }
    List temp1=new LinkedList();
    List temp2=new LinkedList();
    for (    String s : taxonMap.keySet()) {
      temp1.add(s);
      if (!((List)temp2).contains(taxonMap.get(s))) {
        ((List)temp2).add((String)taxonMap.get(s));
      }
    }
    gtTaxa=new String[temp1.size()];
    stTaxa=new String[temp2.size()];
    for (int i=0; i < gtTaxa.length; i++) {
      gtTaxa[i]=((String)temp1.get(i));
    }
    for (int i=0; i < stTaxa.length; i++) {
      stTaxa[i]=((String)((List)temp2).get(i));
    }
  }
 else   if (taxonNameMap != null && taxonNameMap.taxonMap == null) {
    Set<String> taxalist=new HashSet<String>();
    Set<String> genelist=new HashSet<String>();
    for (    Tree tr : trees) {
      String[] leaves=tr.getLeaves();
      for (int i=0; i < leaves.length; i++) {
        String leaf=leaves[i];
        genelist.add(leaf);
        taxalist.add(taxonNameMap.getTaxonName(leaf));
      }
    }
    stTaxa=new String[taxalist.size()];
    gtTaxa=new String[genelist.size()];
    int index=0;
    for (    String taxon : taxalist) {
      stTaxa[(index++)]=taxon;
    }
    index=0;
    for (    String gene : genelist) {
      gtTaxa[(index++)]=gene;
    }
  }
 else {
    cd=null;
    if (rooted & extraTrees == null & taxonNameMap == null && false) {
      cd=doCollapse(trees);
    }
    List<String> taxalist=new ArrayList<String>();
    for (    Tree tr : trees) {
      for (      TNode node : tr.postTraverse()) {
        if ((node.isLeaf()) && (!taxalist.contains(node.getName()))) {
          taxalist.add(node.getName());
        }
      }
    }
    stTaxa=new String[taxalist.size()];
    int index=0;
    for (    String taxon : taxalist) {
      stTaxa[(index++)]=taxon;
    }
    gtTaxa=stTaxa;
  }
  System.err.println("String_Node_Str" + stTaxa.length);
  System.err.println("String_Node_Str" + Arrays.toString(stTaxa));
  clusters=new HashMap<Integer,Set<Vertex>>(stTaxa.length);
  List<Solution> solutions;
  counter=new DuplicationWeightCounter(gtTaxa,stTaxa,rooted,taxonNameMap);
  int sigmaN=counter.computeTreeSTBipartitions(trees,clusters);
  if (extraTrees != null) {
    counter.addExtraBipartitionsByInput(clusters,extraTrees,extrarooted);
  }
  counter.addExtraBipartitionsByHeuristics(clusters);
  if (_print) {
    System.err.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000.0D + "String_Node_Str");
  }
  counter.preCalculateWeights(trees,extraTrees);
  if (_print) {
    System.err.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000.0D + "String_Node_Str");
  }
  sigmaNs=optimizeDuploss == 3 ? sigmaN + 2 * (stTaxa.length - 1) * trees.size() : sigmaN;
  solutions=findTreesByDP(stTaxa,counter,trees,taxonNameMap);
  if (taxonNameMap == null && rooted && extraTrees == null && false) {
    restoreCollapse(solutions,cd);
  }
  return (List<Solution>)solutions;
}

Fixed version (ground truth):
public List<Solution> inferSpeciesTree(){
  long startTime=System.currentTimeMillis();
  String[] gtTaxa;
  String[] stTaxa;
  Collapse.CollapseDescriptor cd=null;
  if ((trees == null) || (trees.size() == 0)) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (taxonNameMap != null && taxonNameMap.taxonMap != null) {
    Map<String,String> taxonMap=taxonNameMap.taxonMap;
    String error=Trees.checkMapping(trees,taxonMap);
    if (error != null) {
      throw new RuntimeException("String_Node_Str" + error + "String_Node_Str");
    }
    List temp1=new LinkedList();
    List temp2=new LinkedList();
    for (    String s : taxonMap.keySet()) {
      temp1.add(s);
      if (!((List)temp2).contains(taxonMap.get(s))) {
        ((List)temp2).add((String)taxonMap.get(s));
      }
    }
    gtTaxa=new String[temp1.size()];
    stTaxa=new String[temp2.size()];
    for (int i=0; i < gtTaxa.length; i++) {
      gtTaxa[i]=((String)temp1.get(i));
    }
    for (int i=0; i < stTaxa.length; i++) {
      stTaxa[i]=((String)((List)temp2).get(i));
    }
  }
 else   if (taxonNameMap != null && taxonNameMap.taxonMap == null) {
    Set<String> taxalist=new HashSet<String>();
    Set<String> genelist=new HashSet<String>();
    for (    Tree tr : trees) {
      String[] leaves=tr.getLeaves();
      for (int i=0; i < leaves.length; i++) {
        String leaf=leaves[i];
        genelist.add(leaf);
        taxalist.add(taxonNameMap.getTaxonName(leaf));
      }
    }
    stTaxa=new String[taxalist.size()];
    gtTaxa=new String[genelist.size()];
    int index=0;
    for (    String taxon : taxalist) {
      stTaxa[(index++)]=taxon;
    }
    index=0;
    for (    String gene : genelist) {
      gtTaxa[(index++)]=gene;
    }
  }
 else {
    cd=null;
    if (rooted & extraTrees == null & taxonNameMap == null && false) {
      cd=doCollapse(trees);
    }
    List<String> taxalist=new ArrayList<String>();
    for (    Tree tr : trees) {
      for (      TNode node : tr.postTraverse()) {
        if ((node.isLeaf()) && (!taxalist.contains(node.getName()))) {
          taxalist.add(node.getName());
        }
      }
    }
    stTaxa=new String[taxalist.size()];
    int index=0;
    for (    String taxon : taxalist) {
      stTaxa[(index++)]=taxon;
    }
    gtTaxa=stTaxa;
  }
  System.err.println("String_Node_Str" + stTaxa.length);
  System.err.println("String_Node_Str" + Arrays.toString(stTaxa));
  clusters=new HashMap<Integer,Set<Vertex>>(stTaxa.length);
  List<Solution> solutions;
  counter=new DuplicationWeightCounter(gtTaxa,stTaxa,rooted,taxonNameMap);
  int sigmaN=counter.computeTreeSTBipartitions(trees,clusters);
  if (extraTrees != null) {
    counter.addExtraBipartitionsByInput(clusters,extraTrees,extrarooted);
  }
  counter.addExtraBipartitionsByHeuristics(clusters);
  if (_print) {
    System.err.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000.0D + "String_Node_Str");
  }
  counter.preCalculateWeights(trees,extraTrees);
  if (_print) {
    System.err.println("String_Node_Str" + (System.currentTimeMillis() - startTime) / 1000.0D + "String_Node_Str");
  }
  sigmaNs=(optimizeDuploss == 3) ? sigmaN + 2 * (stTaxa.length - 1) * trees.size() : sigmaN;
  solutions=findTreesByDP(stTaxa,counter,trees,taxonNameMap);
  if (taxonNameMap == null && rooted && extraTrees == null && false) {
    restoreCollapse(solutions,cd);
  }
  return (List<Solution>)solutions;
}