[Demonstration 1]

[Buggy Method]
Authentication autoLoginByAnonymous(HttpServletRequest request) {
    String anonymous = request.getHeader("x-req-anonymous");
    if (anonymous == null || !anonymousPool.contains(anonymous))
        return null;
    return new RememberMeAuthenticationToken("N/A", anonymousUser, anonymousGrantedAuths);
}

[Buggy Hunk]
Authentication autoLoginByAnonymous(HttpServletRequest request) {

[Patch]
private Authentication autoLoginByAnonymous(HttpServletRequest request) {

[Demonstration 2]

[Buggy Method]
public String getRequestDump(HttpServletRequest request, HttpServletResponse response, String separator) {
    StringBuilder s = new StringBuilder("####REQUEST ").append(request.getMethod()).append(" ").append(request.getRequestURL()).append(separator);
    s.append("Auth type:").append(request.getAuthType()).append(separator);
    s.append("Principal:").append(request.getUserPrincipal()).append(separator);
    s.append(Log.create(request, response).toString()).append(separator);
    s.append("Headers:").append(separator);
    Enumeration<String> headerNames = request.getHeaderNames();
    while (headerNames.hasMoreElements()) {
        String headerName = headerNames.nextElement();
        s.append(headerName).append("=").append(request.getHeader(headerName)).append("  ");
    }
    s.append(separator);
    s.append("####RESPONSE").append(separator);
    s.append("Status:").append(response.getStatus()).append(separator);
    s.append("Char encoding:").append(response.getCharacterEncoding()).append(separator);
    s.append("Locale:").append(response.getLocale()).append(separator);
    s.append("Content type:").append(response.getContentType()).append(separator);
    s.append("Headers:").append(separator);
    s.append(response.getHeaderNames().stream().map(rh -> rh + "=" + response.getHeader(rh)).collect(Collectors.joining(separator)));
    final Long start = (Long) request.getAttribute(RequestLogFilter.REQUEST_TIMER);
    if (start != null) {
        final long elapsedTime = System.nanoTime() - start;
        s.append(separator).append("####Request time elapsed:").append(elapsedTime);
        s.append("ns which is ").append(elapsedTime / 1000000).append("ms").append(separator);
    }
    return s.toString();
}

[Buggy Hunk]
s.append(headerName).append("=").append(request.getHeader(headerName)).append("  ");

[Patch]
s.append(headerName).append("=").append(request.getHeader(headerName)).append(separator);

[Demonstration 3]

[Buggy Method]
public static Set<Run> getUpstreamBuilds(Queue.Item item) {
    Set<Run> upstreamBuilds = new HashSet<Run>();
    for (Cause cause : item.getCauses()) {
        if (cause instanceof Cause.UpstreamCause) {
            Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;
            Run<?, ?> upstreamRun = upstreamCause.getUpstreamRun();
            if (upstreamRun != null && upstreamRun instanceof Run) {
                upstreamBuilds.add(upstreamRun);
            }
        }
    }
    return Collections.unmodifiableSet(upstreamBuilds);
}

[Buggy Hunk]
if (upstreamRun != null && upstreamRun instanceof Run) {

[Patch]
if (upstreamRun != null) {