#vulnerable code 
                                public static String exportToHtml(Option option, String folderPath, String fileName) {
        if (fileName == null || fileName.length() == 0) {
            return exportToHtml(option, folderPath);
        }

        String optionStr = GsonUtil.format(option);
        File folder = new File(folderPath);
        if (folder.exists() && folder.isFile()) {
            String tempPath = folder.getParent();
            folder = new File(tempPath);
        }
        if (!folder.exists()) {
            folder.mkdirs();
        }
        InputStream is = null;
        InputStreamReader iReader = null;
        BufferedReader bufferedReader = null;
        FileWriter writer = null;
        List<String> lines = new ArrayList<String>();
        String line;
        //写入文件
        File html = new File(folder.getPath() + "/" + fileName);
        try {
            is = OptionUtil.class.getResourceAsStream("/template");
            iReader = new InputStreamReader(is);
            bufferedReader = new BufferedReader(iReader);
            while ((line = bufferedReader.readLine()) != null) {
                if (line.contains("##option##")) {
                    line = line.replace("##option##", optionStr);
                }
                lines.add(line);
            }

            writer = new FileWriter(html);
            for (String l : lines) {
                writer.write(l + "\n");
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    //ignore
                }
            }
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    //ignore
                }
            }
        }
        //处理
        try {
            return html.getAbsolutePath();
        } catch (Exception e) {
            return null;
        }
    } 
                            #location 38 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static String exportToHtml(Option option, String folderPath, String fileName) {
        if (fileName == null || fileName.length() == 0) {
            return exportToHtml(option, folderPath);
        }
        FileWriter writer = null;
        List<String> lines = readLines(option);
        //写入文件
        File html = new File(getFolderPath(folderPath) + "/" + fileName);
        try {
            writer = new FileWriter(html);
            for (String l : lines) {
                writer.write(l + "\n");
            }
        } catch (Exception e) {
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    //ignore
                }
            }
        }
        //处理
        try {
            return html.getAbsolutePath();
        } catch (Exception e) {
            return null;
        }
    }