[Demonstration 1]

[Buggy Method]
public void increment() {
    try (Connection conn = connectionProvider.getConnection();
        Statement stmt = conn.createStatement()) {
        stmt.executeUpdate(INCREMENT_COUNTER_STMT);
    } catch (SQLException e) {
        LOGGER.error("exception while incrementing counter", e);
    }
}

[Buggy Hunk]
stmt.executeUpdate(INCREMENT_COUNTER_STMT);

[Patch]
stmt.executeUpdate(INCREMENT_COUNTER);

[Demonstration 2]

[Buggy Method]
public int getNodeCount() {
    int sum = 1;
    for (Node<D> child : getChildren()) {
        sum += getNodeCount();
    }
    return sum;
}

[Buggy Hunk]
sum += getNodeCount();

[Patch]
sum += child.getNodeCount();

[Demonstration 3]

[Buggy Method]
public int loadTreeAnalysis(String[] args) throws Exception {
    if (args.length < 4) {
        System.out.println("arguments should be: filename graphdbfolder (taxonomyalreadyloaded)T|F (subset)");
        return 1;
    }
    String filename = args[1];
    String taxaloaded = args[3];
    boolean tloaded = true;
    boolean isSubset = false;
    if (taxaloaded.toLowerCase().equals("f")) {
        tloaded = false;
    }
    if (args.length == 5) {
        isSubset = true;
    }
    String graphname = args[2];
    int treeCounter = 0;
    // Run through all the trees and get the union of the taxa for a raw taxonomy graph
    // read the tree from a file
    String ts = "";
    List<Tree> jt = new ArrayList<Tree>();
    MessageLogger messageLogger = new MessageLogger("loadTreeAnalysis:");
    Map<TreeNode, String> subsetTipInfo = null;
    Map<Tree, String> sourceForTrees = null;
    try {
        BufferedReader br = new BufferedReader(new FileReader(filename));
        //if (GeneralUtils.divineTreeFormat(br).compareTo("newick") == 0) { // newick
        //assuming that it is newick not nexson
        //assuming we either have the source in front of the newick or just plan newick
        boolean sourceAvail = false;
        String first = br.readLine();
        if (first.split(" ").length > 1 && first.split(" ")[0].length() > 0) {
            sourceAvail = true;
            sourceForTrees = new HashMap<Tree, String>();
        }
        br.close();
        br = new BufferedReader(new FileReader(filename));
        System.out.println("Reading newick file with sourceAvail=" + sourceAvail + "...");
        while ((ts = br.readLine()) != null) {
            if (ts.length() > 1) {
                String source = null;
                if (sourceAvail) {
                    String[] spls = ts.split(" ");
                    source = spls[0];
                    ts = spls[1];
                }
                Tree tt = jade.tree.TreeReader.readTree(ts);
                if (tt.internalNodeCount() < 2) {
                    System.out.println("skipping " + tt);
                    continue;
                }
                //adding the information in the tree for subsetting
                //check the root first
                if (((String) tt.getRoot().getLabel()).contains("subset=")) {
                    if (subsetTipInfo == null)
                        subsetTipInfo = new HashMap<TreeNode, String>();
                    String[] spls = ((String) tt.getRoot().getLabel()).split("subset=");
                    String subset = spls[1];
                    ((jade.tree.JadeNode) tt.getRoot()).setName("");
                    subsetTipInfo.put(tt.getRoot(), subset);
                }
                //now check all the tips
                // first, for compatibility with the test cases, prune prefix XXX_ott from XXX_ottNNN
                for (TreeNode jn : tt.externalNodes()) {
                    if (((String) jn.getLabel()).contains("_ott")) {
                        String[] spls = ((String) jn.getLabel()).split("_ott");
                        String id = spls[1];
                        ((jade.tree.JadeNode) jn).setName(id);
                    }
                }
                for (TreeNode jn : tt.externalNodes()) {
                    if (((String) jn.getLabel()).contains("__subset=")) {
                        if (subsetTipInfo == null) {
                            subsetTipInfo = new HashMap<TreeNode, String>();
                        }
                        String[] spls = ((String) jn.getLabel()).split("__subset=");
                        String name = spls[0];
                        String subset = spls[1];
                        ((jade.tree.JadeNode) jn).setName(name);
                        subsetTipInfo.put(jn, subset);
                    }
                }
                if (sourceAvail) {
                    sourceForTrees.put(tt, source);
                }
                //check the tips
                jt.add(tt);
                treeCounter++;
            }
        }
        /*} else { // nexson
				System.out.println("Reading nexson file...");
				for (JadeTree tree : NexsonReader.readNexson(filename, true, messageLogger)) {
					if (tree == null) {
						messageLogger.indentMessage(1, "Skipping null tree.");
					} else {
						jt.add(tree);
						treeCounter++;
					}
				}
			}*/
        br.close();
    } catch (FileNotFoundException e) {
        //e.printStackTrace();
        System.err.println("Could not open the file \"" + args[1] + "\" Exiting...");
        return -1;
    } catch (IOException ioe) {
    }
    if (treeCounter == 0) {
        System.err.println("No valid trees found in file \"" + args[1] + "\" Exiting...");
        return -1;
    }
    System.out.println(treeCounter + " trees read.");
    GraphDatabaseAgent gdb = new GraphDatabaseAgent(graphname);
    System.out.println("started graph import");
    BipartOracle bo = new BipartOracle(jt, gdb, tloaded, sourceForTrees, subsetTipInfo, isSubset, filename);
    gdb.shutdownDb();
    return 0;
}

[Buggy Hunk]
source= spls[0];

[Patch]
source= spls[0].replace(".tre", "");