[Demonstration 1]

[Buggy Method]
public void actionPerformed(ActionEvent e) {
    String command = e.getActionCommand();
    if (command.substring(0, 5).equals("BOARD")) {
        ((JButton) e.getSource()).setBackground(Color.white);
        LAN.Write(((JButton) e.getSource()).getActionCommand().substring(5));
        SetBoardEnable(false);
        String temp = LAN.Read();
        UpdateGameBoard(temp);
        SetBoardEnable(true);
    } else if (command.equals("START")) {
        startGame();
    }
}

[Buggy Hunk]
LAN.Write(((JButton) e.getSource()).getActionCommand().substring(5));

[Patch]
LAN.Write(((JButton) e.getSource()).getActionCommand().substring(5), "localhost");

[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 static void main(String[] args) {
    // Get all user information from csv file and put it in a map
    loginList = new HashMap<>();
    File inputFile = new File(inputPath);
    try {
        inputFileReader = new BufferedReader(new FileReader(inputFile));
        String nextLine;
        while ((nextLine = inputFileReader.readLine()) != null) {
            // System.out.println(nextLine);
            String[] splitLine = nextLine.split(",");
            String userName = splitLine[0];
            String UserType = splitLine[splitLine.length - 1];
            /*
                 * Here, the loginList map is getting something put into it. The
                 * thing that is put is a userName, which is simply a String,
                 * and an AbstractUser of the type read in from the file. The
                 * problem with this approach is that it assumes well-formed
                 * input. If the input file is off by just a little, this will
                 * break hilariously badly. This is just a temporary solution:
                 * Eventually we will be moving to ObjectReaders anyway.
                 */
            if (!loginList.containsKey(userName)) {
                loginList.put(userName, (AbstractUser) Class.forName(UserType).newInstance());
                loginList.get(userName).email = userName;
            }
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        try {
            inputFileReader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    Scanner in = new Scanner(System.in);
    // Prompt user to log
    System.out.println("Enter your email: ");
    // String userName = in.nextLine();
    // Hardcoded version for easier running later.
    String userName = "testPM@doesntexist.net";
    User currentUser = login(userName);
    if (currentUser instanceof ParkManager) {
        ParkManagerDriver.run(currentUser, in);
    } else if (currentUser instanceof UrbanParksStaffMember) {
        System.out.println("The user was an instance of " + currentUser.getClass() + "!");
    } else if (currentUser instanceof Volunteer) {
        System.out.println("The user was an instance of " + currentUser.getClass() + "!");
    } else {
        System.out.println("Login failed");
    }
    in.close();
}

[Buggy Hunk]
else if (currentUser instanceof UrbanParksStaffMember)

[Patch]
else if (currentUser instanceof UrbanParkStaffMember)