[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<AuthenticationResponse> login(@RequestBody User requestBody) throws ServletException {
    try {
        ExceptionHandler.checkLoginBody(requestBody);
        User dbUser = null;
        if (Validator.isEmpty(requestBody.getUsername())) {
            dbUser = userService.findByEmail(requestBody.getEmail());
        } else {
            dbUser = userService.findByUsername(requestBody.getUsername());
        }
        ExceptionHandler.checkLoginSuccess(requestBody, dbUser);
        String token = tokenBuilder.build(dbUser);
        AuthenticationResponse response = new AuthenticationResponse(token, dbUser);
        return new ResponseEntity<>(response, HttpStatus.OK);
    } catch (GreenboxException e) {
        e.printStackTrace();
        throw new ServletException("Request error while trying to login... " + e.getMessage());
    }
}

[Buggy Hunk]
if (Validator.isEmpty(requestBody.getUsername())) {

[Patch]
if (Validator.isEmptyUsername(requestBody.getUsername())) {

[Demonstration 2]

[Buggy Method]
public static ComplexMatrix multiply(ComplexMatrix matrix1, ComplexMatrix matrix2) throws IllegalArgumentException {
    if (matrix1 == null)
        throw new IllegalArgumentException("matrix1 is null.");
    if (matrix1 == null)
        throw new IllegalArgumentException("matrix2 is null.");
    if (matrix1.numColumns != matrix2.numRows)
        throw new IllegalArgumentException("matrix1.numColumns != matrix2.numRows.");
    ComplexMatrix result = new ComplexMatrix(matrix1.numRows, matrix2.numColumns);
    for (int i = 0; i < result.numRows; i++) for (int j = 0; j < result.numColumns; j++) {
        Complex theElement = new Complex();
        for (int l = 0; l < matrix1.numColumns; l++) {
            theElement = theElement.add(matrix1.get(i, l).multiply(matrix2.get(l, j)));
        }
        result.set(i, j, theElement);
    }
    return result;
}

[Buggy Hunk]
if (matrix1 == null) throw new IllegalArgumentException("matrix2 is null.");

[Patch]
if (matrix2 == null) throw new IllegalArgumentException("matrix2 is null.");

[Demonstration 3]

[Buggy Method]
protected void performGetAction(final String key, final String defaultValue, final Writer output) throws IOException {
    System.out.println("INFO: Get action is performing.");
    String answer = substitutor.get(key);
    if ("".equals(answer) && defaultValue != null) {
        answer = defaultValue;
    }
    output.write("VALUE\n");
    output.write(answer);
    output.write("\n");
}

[Buggy Hunk]
if ("".equals(answer) && defaultValue != null) {

[Patch]
if (answer.isEmpty() && defaultValue != null) {