[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/gigs", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
@Secured("ROLE_ADMIN")
public ResponseEntity<Gig> updateGig(@Valid @RequestBody Gig gig) throws URISyntaxException {
    log.debug("REST request to update Gig : {}", gig);
    if (gig.getId() == null) {
        return createGig(gig);
    }
    // verification that gig is not in the past
    Gig result = gigRepository.save(gig);
    gigSearchRepository.save(result);
    return ResponseEntity.ok().headers(HeaderUtil.createEntityUpdateAlert("gig", gig.getId().toString())).body(result);
}

[Buggy Hunk]
.headers(HeaderUtil.createEntityUpdateAlert("gig", gig.getId().toString()))

[Patch]
.headers(HeaderUtil.createEntityUpdateAlert("gig", gig.getName()))

[Demonstration 2]

[Buggy Method]
public HashMap<String, String> getFavouriteFilters() {
    HashMap<String, String> filters = new HashMap<>();
    String requestURL = JIRA_REST_BASE_URL + "/filter/favourite?expand";
    try {
        URL url = new URL(requestURL);
        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
        connection.setRequestProperty("Cookie", "JSESSIONID=" + mJsessionID);
        connection.setDoInput(true);
        connection.connect();
        InputStream input = connection.getInputStream();
        BufferedReader reader = new BufferedReader(new InputStreamReader(input, "iso-8859-1"), 8);
        StringBuilder sb = new StringBuilder();
        String line;
        while ((line = reader.readLine()) != null) {
            sb.append(line).append("\n");
        }
        JSONArray jsonArray = new JSONArray(sb.toString());
        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject jsonObject = jsonArray.getJSONObject(i);
            String filterName = jsonObject.getString("name");
            String searchUrl = jsonObject.getString("searchUrl");
            filters.put(filterName, searchUrl);
        }
    } catch (Exception ex) {
        Log.e("BATU", ex.getMessage());
    }
    return filters;
}

[Buggy Hunk]
String requestURL               = JIRA_REST_BASE_URL+"/filter/favourite?expand";

[Patch]
String requestURL               = JIRA_BASE_URL+"/rest/api/2/filter/favourite?expand";

[Demonstration 3]

[Buggy Method]
public Data load() {
    JsonReader jr = null;
    try {
        final InputStreamReader isr = new InputStreamReader(new FileInputStream(this.loadFile));
        jr = new JsonReader(isr);
        final Data data = new Gson().fromJson(jr, Data.class);
        return data;
    } catch (final FileNotFoundException e) {
        return new Data();
    } finally {
        IOUtils.closeQuietly(jr);
    }
}

[Buggy Hunk]
return new Data();

[Patch]
return new Data("", "0", "0");