[Demonstration 1]

[Buggy Method]
@Test
public void shouldSuccessfullyProcessTypes() {
    Attribute attribute = new Attribute();
    attribute.setAttributeName("title");
    attribute.setType("string");
    attribute.setValidator(false);
    Attribute attribute2 = new Attribute();
    attribute2.setAttributeName("genre");
    attribute2.setType("Genre");
    attribute2.setValidator(false);
    Attribute attribute3 = new Attribute();
    attribute3.setAttributeName("label");
    attribute3.setType("Label");
    attribute3.setValidator(false);
    Attribute attribute4 = new Attribute();
    attribute4.setAttributeName("weight");
    attribute4.setType("integer");
    attribute4.setValidator(false);
    Type type1 = new Type();
    type1.setName("Track");
    type1.setAttributes(Arrays.asList(attribute, attribute2));
    Type type2 = new Type();
    type2.setName("Person");
    type2.setAttributes(Arrays.asList(attribute3, attribute4));
    Type type3 = new Type();
    type3.setName("Genre");
    type3.setAttributes(new ArrayList<>());
    Type type4 = new Type();
    type4.setName("Label");
    type4.setAttributes(new ArrayList<>());
    try {
        ServiceDefinition serviceDefinition = new ServiceDefinition();
        serviceDefinition.setNamespace(NAMESPACE);
        serviceDefinition.setTypes(Arrays.asList(type1, type2, type3, type4));
        victim = new TypesProcessor(serviceDefinition);
        List<TypeOutputClass> typeOutputClasses = victim.process();
        assertEquals(typeOutputClasses.size(), 4);
        assertTrue(typeOutputClasses.stream().map(TypeOutputClass::getNamespace).allMatch(ns -> ns.equals(NAMESPACE + ".waffle.type")));
        assertTrue(typeOutputClasses.stream().map(TypeOutputClass::getTypeName).collect(Collectors.toList()).containsAll(Arrays.asList("Track", "Person", "Genre", "Label")));
    } catch (Exception e) {
        fail(e.getMessage());
    }
}

[Buggy Hunk]
.allMatch(ns -> ns.equals(NAMESPACE + ".waffle.type")));

[Patch]
.allMatch(ns -> ns.equals(NAMESPACE)));

[Demonstration 2]

[Buggy Method]
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
    Element element = document.createElementNS(uri, qName);
    int attrLength = attributes.getLength();
    for (int i = 0; i < attrLength; i++) {
        element.setAttributeNS(attributes.getURI(i), attributes.getQName(i), attributes.getValue(i));
    }
    if (rootElement == null) {
        rootElement = element;
        currentElement = element;
    } else {
        currentElement.appendChild(element);
        currentElement = element;
    }
    if ("VehicleActivity".equals(qName)) {
        lineRefMatched = false;
        vehicleRefMatched = false;
    }
}

[Buggy Hunk]
if("VehicleActivity".equals(qName)){

[Patch]
if("VehicleActivity".equals(localName)){

[Demonstration 3]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));