[Demonstration 1]

[Buggy Method]
public void run() {
    ClientObject clientID = null;
    try {
        InputStream input = clientSocket.getInputStream();
        OutputStream output = clientSocket.getOutputStream();
        String receivedMSG = "";
        String response;
        String[] parsedInput;
        RequestManager requestManager = new RequestManager();
        String localOutput;
        try {
            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
            // Client should automatically send it's info to the server
            receivedMSG = in.readLine();
            // Break up messages into commands separated by "'#"
            parsedInput = receivedMSG.split(SPECIAL_BREAK_SYMBOL);
            clientID = new ClientObject(parsedInput[0], parsedInput[1]);
            // Add the new client to the Client list.
            clientList.add(clientID);
            while (!receivedMSG.equals("exit")) {
                receivedMSG = in.readLine();
                System.out.println(receivedMSG);
                if (receivedMSG.equals("show user list")) {
                    localOutput = requestManager.getClientListString(clientList);
                    System.out.println(localOutput);
                } else if (receivedMSG.contains("'#")) {
                    parsedInput = receivedMSG.split(SPECIAL_BREAK_SYMBOL);
                    if (parsedInput.length == 2) {
                        if (parsedInput[0].equals("add")) {
                            requestManager.clientRequestAdd(parsedInput[1], clientID, fileList);
                        } else if (parsedInput[0].equals("get")) {
                            response = requestManager.clientRequestGet(parsedInput[1], fileList);
                            output.write(response.getBytes());
                        }
                    }
                }
            }
        } catch (IOException e) {
            System.out.println("Read failed");
            System.exit(-1);
        }
        long time = System.currentTimeMillis();
        output.close();
        input.close();
        System.out.println(receivedMSG + "      " + time);
    } catch (IOException e) {
        //report exception somewhere.
        e.printStackTrace();
    }
}

[Buggy Hunk]
receivedMSG = in.readLine();                // Client should automatically send it's info to the server

[Patch]
receivedMSG = in.readLine();  System.out.println("_____ " + receivedMSG); while(receivedMSG == null);          // Client should automatically send it's info to the server

[Demonstration 2]

[Buggy Method]
public void addListenerOnButton() {
    final Context context = this;
    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            Intent intent = new Intent(context, Payment_Step2.class);
            intent.putExtra("amount", editText.getText().toString().substring(1));
            startActivity(intent);
        }
    });
}

[Buggy Hunk]
intent.putExtra("amount", editText.getText().toString().substring(1));

[Patch]
intent.putExtra("amount", editText.getText().toString());

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