[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/download/{fileName}")
public String downloadFile(@PathVariable String fileName, HttpServletRequest request, HttpServletResponse response) {
    fileName = getRealFileName(fileName);
    response.setCharacterEncoding("utf-8");
    response.setContentType("multipart/form-data");
    response.setHeader("Content-Disposition", "attachment;fileName=" + fileName);
    String path = FileUtil.getvalue("result_file_full_path", "sm.properties");
    try (InputStream inputStream = new FileInputStream(new File(path + File.separator + fileName));
        OutputStream os = response.getOutputStream()) {
        byte[] b = new byte[2048];
        int length;
        while ((length = inputStream.read(b)) > 0) {
            os.write(b, 0, length);
        }
    } catch (Exception e) {
        throw new SMRuntimeException("The error happens while downloading a file named " + fileName, e);
    }
    return null;
}

[Buggy Hunk]
String path = FileUtil.getvalue("result_file_full_path", "sm.properties");

[Patch]
String path = FileUtil.getValue("result_file_full_path", "/server.properties");

[Demonstration 2]

[Buggy Method]
public static InputStream fileToInputStream(String fileName) throws FileNotFoundException {
    File file = new File(fileName);
    if (!file.exists()) {
        Log.e(TAG_CLASS, fileName + " not found.");
        return null;
    }
    return new FileInputStream(file);
}

[Buggy Hunk]
public static InputStream fileToInputStream(String fileName) throws FileNotFoundException {

[Patch]
public static InputStream fileToInputStream(final String fileName) throws FileNotFoundException {

[Demonstration 3]

[Buggy Method]
public static void readCommandsFromFile(String fileName) throws IOException {
    Stream<String> stream = Files.lines(Paths.get(fileName));
    stream.forEach(System.out::println);
}

[Buggy Hunk]
public static void readCommandsFromFile(String fileName) throws IOException {

[Patch]
public void readCommandsFromFile(String fileName) throws IOException {