Program: 50218
Project: 50218
Buggy source:
/** 
 * @returns 0 for success, 1 for error, 2 for error with a request that the generic help be displayed
 */
public int graphImporterParser(String[] args) throws TaxonNotFoundException, DataFormatException, TreeIngestException {
  boolean readingNewick=false;
  boolean readingNexson=false;
  if (args[0].compareTo("String_Node_Str") == 0) {
    readingNewick=true;
  }
  if (args[0].compareTo("String_Node_Str") == 0) {
    readingNexson=true;
  }
 else {
    return 2;
  }
  String filename;
  String idfilename="String_Node_Str";
  String focalgroup;
  String sourcename;
  String graphname;
  if (readingNewick) {
    if (args.length != 6) {
      System.out.println("String_Node_Str");
      return 1;
    }
    filename=args[1];
    idfilename=args[2];
    focalgroup=args[3];
    sourcename=args[4];
    graphname=args[5];
  }
 else {
    if (args.length != 5) {
      System.out.println("String_Node_Str");
      return 1;
    }
    filename=args[1];
    focalgroup=args[2];
    sourcename=args[3];
    graphname=args[4];
  }
  int treeCounter=0;
  GraphImporter gi=new GraphImporter(graphname);
  try {
    if (gi.hasSoureTreeName(sourcename)) {
      String emsg="String_Node_Str" + sourcename + "String_Node_Str";
      throw new TreeIngestException(emsg);
    }
    System.out.println("String_Node_Str" + filename);
    ArrayList<JadeTree> jt=new ArrayList<JadeTree>();
    try {
      if (readingNewick) {
        System.out.println("String_Node_Str");
        TreeReader tr=new TreeReader();
        BufferedReader ibr=new BufferedReader(new FileReader(idfilename));
        String treeID;
        String ts="String_Node_Str";
        BufferedReader br=new BufferedReader(new FileReader(filename));
        int treeNum=0;
        while ((ts=br.readLine()) != null) {
          if (ts.length() > 1) {
            ++treeNum;
            treeID="String_Node_Str";
            while (treeID.length() == 0) {
              if (null == (treeID=ibr.readLine())) {
                String emsg="String_Node_Str" + filename + "String_Node_Str"+ treeNum+ "String_Node_Str"+ idfilename+ "String_Node_Str";
                throw new TreeIngestException(emsg);
              }
            }
            JadeTree newestTree=tr.readTree(ts);
            newestTree.assocObject("String_Node_Str",treeID);
            jt.add(newestTree);
            treeCounter++;
          }
        }
        br.close();
      }
 else {
        System.out.println("String_Node_Str");
        for (        JadeTree tree : NexsonReader.readNexson(filename)) {
          jt.add(tree);
          treeCounter++;
        }
      }
    }
 catch (    IOException ioe) {
    }
    System.out.println(treeCounter + "String_Node_Str");
    for (int i=0; i < jt.size(); i++) {
      System.out.println("String_Node_Str" + i);
      gi.setTree(jt.get(i));
      if (jt.get(i).getObject("String_Node_Str") != null) {
        sourcename=(String)jt.get(i).getObject("String_Node_Str");
      }
      if (jt.size() == 1) {
        gi.addSetTreeToGraph(focalgroup,sourcename);
        gi.updateAfterTreeIngest(false);
      }
 else {
        gi.addSetTreeToGraph(focalgroup,sourcename + "String_Node_Str" + String.valueOf(i));
        gi.deleteTreeBySource(sourcename + "String_Node_Str" + String.valueOf(i));
      }
    }
    if (jt.size() > 1) {
      for (int i=0; i < jt.size(); i++) {
        if (jt.get(i).getObject("String_Node_Str") != null) {
          sourcename=(String)jt.get(i).getObject("String_Node_Str");
        }
        System.out.println("String_Node_Str" + i);
        gi.setTree(jt.get(i));
        gi.addSetTreeToGraph(focalgroup,sourcename + "String_Node_Str" + String.valueOf(i));
      }
    }
  }
  finally {
    gi.shutdownDB();
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * @returns 0 for success, 1 for error, 2 for error with a request that the generic help be displayed
 */
public int graphImporterParser(String[] args) throws TaxonNotFoundException, DataFormatException, TreeIngestException {
  boolean readingNewick=false;
  boolean readingNexson=false;
  if (args[0].compareTo("String_Node_Str") == 0) {
    readingNewick=true;
  }
 else   if (args[0].compareTo("String_Node_Str") == 0) {
    readingNexson=true;
  }
 else {
    System.out.println("String_Node_Str" + args[0] + "String_Node_Str");
    return 2;
  }
  String filename;
  String idfilename="String_Node_Str";
  String focalgroup;
  String sourcename;
  String graphname;
  if (readingNewick) {
    if (args.length != 6) {
      System.out.println("String_Node_Str");
      return 1;
    }
    filename=args[1];
    idfilename=args[2];
    focalgroup=args[3];
    sourcename=args[4];
    graphname=args[5];
  }
 else {
    if (args.length != 5) {
      System.out.println("String_Node_Str");
      return 1;
    }
    filename=args[1];
    focalgroup=args[2];
    sourcename=args[3];
    graphname=args[4];
  }
  int treeCounter=0;
  GraphImporter gi=new GraphImporter(graphname);
  try {
    if (gi.hasSoureTreeName(sourcename)) {
      String emsg="String_Node_Str" + sourcename + "String_Node_Str";
      throw new TreeIngestException(emsg);
    }
    System.out.println("String_Node_Str" + filename);
    ArrayList<JadeTree> jt=new ArrayList<JadeTree>();
    try {
      if (readingNewick) {
        System.out.println("String_Node_Str");
        TreeReader tr=new TreeReader();
        BufferedReader ibr=new BufferedReader(new FileReader(idfilename));
        String treeID;
        String ts="String_Node_Str";
        BufferedReader br=new BufferedReader(new FileReader(filename));
        int treeNum=0;
        while ((ts=br.readLine()) != null) {
          if (ts.length() > 1) {
            ++treeNum;
            treeID="String_Node_Str";
            while (treeID.length() == 0) {
              if (null == (treeID=ibr.readLine())) {
                String emsg="String_Node_Str" + filename + "String_Node_Str"+ treeNum+ "String_Node_Str"+ idfilename+ "String_Node_Str";
                throw new TreeIngestException(emsg);
              }
            }
            JadeTree newestTree=tr.readTree(ts);
            newestTree.assocObject("String_Node_Str",treeID);
            jt.add(newestTree);
            treeCounter++;
          }
        }
        br.close();
      }
 else {
        System.out.println("String_Node_Str");
        for (        JadeTree tree : NexsonReader.readNexson(filename)) {
          jt.add(tree);
          treeCounter++;
        }
      }
    }
 catch (    IOException ioe) {
    }
    System.out.println(treeCounter + "String_Node_Str");
    for (int i=0; i < jt.size(); i++) {
      System.out.println("String_Node_Str" + i);
      gi.setTree(jt.get(i));
      if (jt.get(i).getObject("String_Node_Str") != null) {
        sourcename=(String)jt.get(i).getObject("String_Node_Str");
      }
      if (jt.size() == 1) {
        gi.addSetTreeToGraph(focalgroup,sourcename);
        gi.updateAfterTreeIngest(false);
      }
 else {
        gi.addSetTreeToGraph(focalgroup,sourcename + "String_Node_Str" + String.valueOf(i));
        gi.deleteTreeBySource(sourcename + "String_Node_Str" + String.valueOf(i));
      }
    }
    if (jt.size() > 1) {
      for (int i=0; i < jt.size(); i++) {
        if (jt.get(i).getObject("String_Node_Str") != null) {
          sourcename=(String)jt.get(i).getObject("String_Node_Str");
        }
        System.out.println("String_Node_Str" + i);
        gi.setTree(jt.get(i));
        gi.addSetTreeToGraph(focalgroup,sourcename + "String_Node_Str" + String.valueOf(i));
      }
    }
  }
  finally {
    gi.shutdownDB();
  }
  return 0;
}