[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_events_page);
    try {
        FileInputStream input = openFileInput("eventDataFile");
        int character;
        String temp = "";
        while ((character = input.read()) != -1) {
            temp = temp + Character.toString((char) character);
        }
        fileInfo = temp;
        Log.d("File info", fileInfo);
        while (true) {
            int index = temp.indexOf("Title: ");
            if (index == -1) {
                break;
            }
            temp = temp.substring(index + 7);
            int index2 = temp.indexOf(" ");
            String listInput = temp.substring(0, index2);
            tempTitles.add(listInput);
        }
        //Just checking it worked
        String tester = "";
        for (int i = 0; i < tempTitles.size(); i++) {
            tester = tester + tempTitles.get(i) + ", ";
        }
        Log.d("Test values: ", tester);
        titles = new String[tempTitles.size()];
        for (int i = 0; i < tempTitles.size(); i++) {
            titles[i] = tempTitles.get(i);
        }
        //Just checking it worked
        tester = "";
        for (int i = 0; i < titles.length; i++) {
            tester = tester + titles[i] + ", ";
        }
        Log.d("Test values: ", tester);
        ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, titles);
        ListView listView = (ListView) findViewById(R.id.listView);
        listView.setAdapter(adapter);
        listView.setOnItemClickListener(mMessageClickedHandler);
    } catch (Exception e) {
    }
}

[Buggy Hunk]
int index2 = temp.indexOf(" ");

[Patch]
int index2 = temp.indexOf("Description: ")-1;

[Demonstration 2]

[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));

[Demonstration 3]

[Buggy Method]
public void createImage() {
    g2.clearRect(0, 0, 2 * width, 2 * height);
    //Border
    g2.setColor(Color.YELLOW);
    g2.setStroke(new BasicStroke(2));
    g2.fillRect(140, 140, width + 20, height + 20);
    g2.setColor(Color.WHITE);
    g2.fillRect(150, 150, width, height);
    //drawBox
    g2.setColor(Color.ORANGE);
    for (int i = 0; i < box.length; i++) {
        g2.fillRect(box[i].xPos, box[i].yPos, box[i].width, box[i].height);
    }
    //Test if robot has collided
    tester.robotCollision();
    //Draw Robot | body
    g2.setColor(Color.GREEN);
    g2.fillOval(robot.getX() - 5, robot.getY() - 5, 10, 10);
    //Draw Robot | Heading
    g2.setStroke(new BasicStroke(5));
    g2.drawLine(robot.getX(), robot.getY(), (int) (robot.getX() + 10 * Math.cos(robot.getHeading())), (int) (robot.getY() + 10 * Math.sin(robot.getHeading())));
    //sensor
    for (int i = 0; i < sensor.length; i++) {
        sensorReadings[i] = sensor[i].detect();
        if (sensorReadings[i][0] == 1) {
            g2.setColor(Color.GRAY);
            g2.setStroke(new BasicStroke(1));
            g2.drawLine(robot.getX(), robot.getY(), sensor[i].getContactX(), sensor[i].getContactY());
            g2.setColor(Color.RED);
        } else {
            g2.setColor(Color.BLUE);
        }
        g2.setStroke(new BasicStroke(1));
        g2.fillOval(sensor[i].getEndpointX() - 1, sensor[i].getEndpointY() - 1, 3, 3);
    }
    //Draw Robot's Path
    for (int i = 0; i < path.getLength(); i++) {
        g2.setColor(new Color(255 - 4 * i, 255 - 2 * i, 255 - 5 * i));
        g2.fillOval(xPath.getPath()[i] - 2, yPath.getPath()[i] - 2, 4, 4);
    }
}

[Buggy Hunk]
tester.robotCollision();

[Patch]
if(tester.robotCollision()){robot.collided=true;}