[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/downloadReport", method = RequestMethod.GET, produces = "application/vnd.ms-excel")
@ResponseBody
public String getBulkDataImportCSV(HttpServletResponse response, @DefaultValue("") @QueryParam("fileName") String fileName, @DefaultValue("") @QueryParam("rootPath") String rootPath) throws ParseException, java.text.ParseException {
    //        adminService.getBulkDataImportCSV();
    response.setContentType("APPLICATION/OCTECT-STREAM");
    if (StringUtils.isEmpty(fileName) || StringUtils.isEmpty(rootPath)) {
        fileName = "";
        rootPath = "";
        return "fail";
    }
    String reportName = fileName;
    String reportPath = reports + rootPath;
    try {
        PrintWriter out = response.getWriter();
        String filename = reportName;
        response.setHeader("Content-Disposition", "attachment;filename=\"" + filename + "\"");
        FileInputStream fl = new FileInputStream(reportPath + reportName);
        int i;
        while ((i = fl.read()) != -1) {
            out.write(i);
        }
        fl.close();
        out.close();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return "success";
}

[Buggy Hunk]
PrintWriter out = response.getWriter();

[Patch]
ServletOutputStream out = response.getOutputStream();

[Demonstration 2]

[Buggy Method]
@SuppressWarnings("unused")
private static String shortenXinLang(String longUrl) {
    String shortUrl = null;
    if (longUrl != null && !StringUtils.isEmpty(longUrl)) {
        String param = "source=" + AppKey + "&url_long=" + longUrl;
        String response = null;
        try {
            response = HttpUtil1.sendPost(SERVICE_URL, param);
            JSONObject backJson = JSONObject.parseObject(response);
            if (backJson.containsKey("urls")) {
                // 生成成功
                JSONArray urls = backJson.getJSONArray("urls");
                shortUrl = ((JSONObject) urls.get(0)).getString("url_short");
            } else {
                // 生成失败
                LOGGER.error("shorten error for longUrl=" + longUrl + " with response: " + response);
            }
        } catch (Exception e) {
            LOGGER.error("生成短链接失败", e);
        }
    }
    return shortUrl;
}

[Buggy Hunk]
response = HttpUtil1.sendPost(SERVICE_URL, param);

[Patch]
response = HttpUtil.sendPost(SERVICE_URL, param);

[Demonstration 3]

[Buggy Method]
@PostMapping(value = "/Borc/SiparisListesiDTO")
public ResponseEntity<SiparisListesiDTO> addSiparisListesi(@RequestBody SiparisListesiDTO siparisListesiDTO) {
    this.service.addSiparis(siparisListesiDTO);
    return new ResponseEntity(siparisListesiDTO, HttpStatus.CREATED);
}

[Buggy Hunk]
this.service.addSiparis(siparisListesiDTO);

[Patch]
this.service.updateSiparis(siparisListesiDTO);