[Demonstration 1]

[Buggy Method]
private void findParagraphs(String fileName) throws AlignmentParserException {
    try {
        File inputFile = new File(fileName);
        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
        Document doc = dBuilder.parse(inputFile);
        doc.getDocumentElement().normalize();
        NodeList allTags = doc.getElementsByTagName("p");
        for (int tag = 0; tag < allTags.getLength(); tag++) {
            Node oneTag = allTags.item(tag);
            NamedNodeMap attributes = oneTag.getAttributes();
            /**
             * If the current paragraph does not have an "id" attribute,
             * the Paragraph class will generate a random, negative one
             * by default.
             */
            if (attributes.getNamedItem("id").getNodeValue() == null) {
                paragraphs.add(new Paragraph(oneTag.getTextContent()));
            } else {
                int pid = Integer.parseInt(attributes.getNamedItem("id").getNodeValue());
                paragraphs.add(new Paragraph(pid, oneTag.getTextContent()));
            }
        }
    } catch (ParserConfigurationException | SAXException | IOException err) {
        throw new AlignmentParserException(err.getMessage());
    }
}

[Buggy Hunk]
if (attributes.getNamedItem("id").getNodeValue() == null) {

[Patch]
if (attributes.getNamedItem("id") == null) {

[Demonstration 2]

[Buggy Method]
public static String naiveSearch(String indexingQuery, String lowercaseQuery, TransitSourceTitles routeKeysToTitles) {
    if (routeKeysToTitles.hasRoute(indexingQuery)) {
        return indexingQuery;
    } else {
        //try the titles
        for (String route : routeKeysToTitles.routeTags()) {
            String title = routeKeysToTitles.getTitle(route);
            String titleWithoutSpaces = title.toLowerCase().replaceAll(" ", "");
            if (titleWithoutSpaces.equals(lowercaseQuery)) {
                return route;
            }
        }
        //no match
        return null;
    }
}

[Buggy Hunk]
String titleWithoutSpaces = title.toLowerCase().replaceAll(" ", "");

[Patch]
String titleWithoutSpaces = title.toLowerCase(Locale.US).replaceAll(" ", "");

[Demonstration 3]

[Buggy Method]
public static String _GetNextStep(String player_name, String[] board) {
    Scanner keyboard;
    keyboard = new Scanner(System.in);
    String step = "x9";
    System.out.print("What's our vector Victor " + player_name + "? ");
    boolean flag = false;
    do {
        if (flag) {
            System.out.print("Surely you can't be serious?");
        }
        step = keyboard.nextLine();
        flag = true;
    } while (_IsThatStepValid(board, step) == false);
    return step;
}

[Buggy Hunk]
System.out.print("What's our vector Victor " + player_name + "? ");

[Patch]
System.out.print("What's our vector Victor? ");