[Demonstration 1]

[Buggy Method]
public void moveOneDisc(int source, int destination) throws TowerIsEmptyException, TowerIsFullException {
    Tower towerSource = this.towers.get(source);
    Tower towerDestination = this.towers.get(destination);
    if (!towerSource.isEmpty() && !towerDestination.isFull()) {
        Disc discToMove = towerSource.pop();
        towerDestination.push(discToMove);
        System.out.println(source + "->" + destination);
    }
}

[Buggy Hunk]
System.out.println(source + "->" + destination);

[Patch]
this.display();

[Demonstration 2]

[Buggy Method]
public void onArticleSelected(String position) {
    // The user selected the headline of an article from the HeadlinesFragment
    // Capture the article fragment from the activity layout
    DetailPlugFragment articleFrag = (DetailPlugFragment) getSupportFragmentManager().findFragmentById(R.id.plug_details);
    if (articleFrag != null) {
        // If article frag is available, we're in two-pane layout...
        // Call a method in the ArticleFragment to update its content
        articleFrag.updateArticleView(position);
    } else {
        // If the frag is not available, we're in the one-pane layout and must swap frags...
        // Create fragment and give it an argument for the selected article
        DetailPlugFragment newFragment = new DetailPlugFragment();
        Bundle args = new Bundle();
        args.putString(DetailPlugFragment.ARG_PID, position);
        newFragment.setArguments(args);
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        // Replace whatever is in the fragment_container view with this fragment,
        // and add the transaction to the back stack so the user can navigate back
        transaction.replace(R.id.plugs, newFragment);
        transaction.addToBackStack(null);
        // Commit the transaction
        transaction.commit();
    }
}

[Buggy Hunk]
transaction.replace(R.id.plugs, newFragment);

[Patch]
transaction.replace(R.id.plugs_list, newFragment);

[Demonstration 3]

[Buggy Method]
private void read(String fname) {
    try {
        BufferedReader r = new BufferedReader(new FileReader("content/" + fname));
        String line;
        State current = null;
        while ((line = r.readLine()) != null) {
            Matcher m = statePat.matcher(line);
            if (m.matches()) {
                String state = m.group(2);
                if (states.containsKey(state)) {
                    System.err.println("Duplicate states! Please check files");
                    System.exit(0);
                }
                String type = m.group(1);
                System.out.println("State " + state + " " + type);
                current = new State(state, type);
                states.put(state, current);
            }
            m = transPat.matcher(line);
            if (m.matches()) {
                String state = m.group(1);
                String action = m.group(2).trim();
                current.addTransition(state, action);
            }
        }
    } catch (FileNotFoundException ex) {
        Logger.getLogger(ContentManager.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        Logger.getLogger(ContentManager.class.getName()).log(Level.SEVERE, null, ex);
    }
}

[Buggy Hunk]
System.err.println("Duplicate states! Please check files");

[Patch]
System.err.println("Duplicate state "+state+ " in file "+fname+ "! Aborting.");