[Demonstration 1]

[Buggy Method]
public void parse(Properties languageProps, Properties executableProps) throws Exception {
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.parse(XMLpath);
    groupstxt = null;
    if ((new File(GroupsPath)).exists()) {
        groupstxt = new BufferedReader(new FileReader(GroupsPath));
    }
    //NodeList problem = doc.getDocumentElement().getChildNodes();
    Element el = doc.getDocumentElement();
    shortName = el.getAttribute("short-name");
    System.out.println("\nparsing problem '" + shortName + "'");
    url = el.getAttribute("url");
    if (ID.startsWith("com.codeforces.polygon") || ID.equals("auto")) {
        String[] t = url.split("/");
        String cflogin = t[t.length - 2];
        if (cflogin.contains(".")) {
            System.out.println("WARNING: Problem owner login contains '.', replacing with '-'");
            cflogin = cflogin.replaceAll("\\.", "-");
        }
        ID = "com.codeforces.polygon." + cflogin;
    }
    ID = ID + "." + shortName;
    //names
    NodeList nl = ((Element) doc.getElementsByTagName("names").item(0)).getElementsByTagName("name");
    for (int i = 0; i < nl.getLength(); i++) {
        Node n = nl.item(i);
        el = (Element) n;
        if (el.getAttribute("language").equals("russian")) {
            Name = el.getAttribute("value");
            System.out.println("problem name = '" + Name + "'");
        } else {
            System.out.println(el.getAttribute("language"));
        }
    }
    //judging
    el = (Element) doc.getElementsByTagName("judging").item(0);
    input = el.getAttribute("input-file");
    if (input.isEmpty())
        input = "*";
    output = el.getAttribute("output-file");
    if (output.isEmpty())
        output = "*";
    //testset
    nl = el.getElementsByTagName("testset");
    for (int i = 0; i < nl.getLength(); i++) {
        //testset
        //System.out.println("DEBUG: testsets cnt = " + nl.getLength() + " i = " + i);
        el = (Element) nl.item(i);
        Testset ts = new Testset();
        ts.parse(this, el);
        testsets.put(ts.name, ts);
        //System.out.println("testset finished");
    }
    if (!hasPreliminary) {
        System.out.println("INFO: No preliminary testset, getting sample tests");
        Test[] temp = new Test[sampleCount];
        for (int i = 0; i < sampleCount; i++) {
            temp[i] = testsets.get("tests").tests[i];
        }
        Testset preliminary = new Testset();
        preliminary.tests = temp;
        preliminary.name = "preliminary";
        preliminary.inputName = testsets.get("tests").inputName;
        preliminary.outputName = testsets.get("tests").outputName;
        preliminary.inputHref = testsets.get("tests").inputHref;
        preliminary.outputHref = testsets.get("tests").outputHref;
        preliminary.memoryLimit = testsets.get("tests").memoryLimit;
        preliminary.timeLimit = testsets.get("tests").timeLimit;
        testsets.put("preliminary", preliminary);
    }
    //parse points and groups
    if (testsets.get("tests").groups.size() != 0) {
        ArrayList<Group> gg = testsets.get("tests").groups;
        Group.parse(groupstxt, gg);
        for (int i = 0; i < gg.size(); i++) {
            gg.get(i).parseIntPoints();
        }
    }
    //files attachments
    el = (Element) ((Element) doc.getElementsByTagName("files").item(0)).getElementsByTagName("attachments").item(0);
    attachments = new ArrayList<>();
    if (el != null) {
        nl = el.getElementsByTagName("file");
        for (int i = 0; i < nl.getLength(); i++) {
            el = (Element) nl.item(i);
            Attachment[] attachs = Attachment.parse(this, el, languageProps);
            if (attachs != null) {
                for (Attachment attach : attachs) {
                    if (attach != null) {
                        attachments.add(attach);
                    }
                }
            }
        }
    }
    //assets (checker)
    el = (Element) ((Element) doc.getElementsByTagName("assets").item(0)).getElementsByTagName("checker").item(0);
    verifier = Verifier.parse(el, executableProps);
    el = (Element) ((Element) doc.getElementsByTagName("assets").item(0)).getElementsByTagName("interactor").item(0);
    interactor = Interactor.parse(el, executableProps);
    if (interactor != null) {
        for (Testset e : testsets.values()) {
            e.inputName = shortName + ".in";
            e.outputName = shortName + ".out";
        }
    }
}

[Buggy Hunk]
Document doc = builder.parse(XMLpath);

[Patch]
Document doc = builder.parse(new File(XMLpath));

[Demonstration 2]

[Buggy Method]
@Override
protected AsyncEventService getAsyncEventService() {
    return new AmazonAsyncEventService(queueManagerFactory, indexProcessorFig, indexProducer, metricsFactory, entityCollectionManagerFactory, indexLocationStrategyFactory, entityIndexFactory, eventBuilder, rxTaskScheduler);
}

[Buggy Hunk]
return  new AmazonAsyncEventService( queueManagerFactory, indexProcessorFig, indexProducer, metricsFactory,  entityCollectionManagerFactory, indexLocationStrategyFactory, entityIndexFactory, eventBuilder, rxTaskScheduler );

[Patch]
return  new AmazonAsyncEventService( queueManagerFactory, indexProcessorFig, indexProducer, metricsFactory,  entityCollectionManagerFactory, indexLocationStrategyFactory, entityIndexFactory, eventBuilder, mapManagerFactory, queueFig,  rxTaskScheduler );

[Demonstration 3]

[Buggy Method]
public void fix(File srcFile, File destFile) throws Exception {
    DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
    Document doc = docBuilder.parse(srcFile);
    // Fix Strings
    NodeList nodes = doc.getElementsByTagName("string");
    if (nodes != null && nodes.getLength() > 0) {
        for (int i = 0; i < nodes.getLength(); i++) {
            Node item = nodes.item(i);
            // Fix Key
            if (item.getAttributes() != null) {
                Node keyNode = item.getAttributes().getNamedItem("name");
                if (keyNode != null) {
                    String key = keyNode.getTextContent();
                    ((Element) item).setAttribute("name", fixKey(key));
                }
            }
            // Fix Value
            if (item.getFirstChild() != null) {
                String value = item.getFirstChild().getNodeValue();
                ((Element) item).getFirstChild().setNodeValue(fixValue(value));
            }
        }
    }
    // add new resources
    for (String childNodeString : extraResourcesInStringArray) {
        addStringChildNode(docBuilder, doc, childNodeString);
    }
    printXmlDocument(doc, destFile);
}

[Buggy Hunk]
addStringChildNode(docBuilder, doc, childNodeString);

[Patch]
addStringChildNode(docBuilder, doc, childNodeString, encoding);