#vulnerable code 
                                public static List<String> readFileLinesGuessEncoding(String filePath, int maxFileLineDepth) throws IOException {
        BufferedReader reader = new BufferedReader( new InputStreamReader( new FileInputStream(filePath), guessCharset(new File(filePath))));

        List<String> fileLines = new ArrayList<>();
        String line = "";

        int lineCount = 0;
        while ((line = reader.readLine()) != null) {
            lineCount++;

            fileLines.add(line);

            if (lineCount == maxFileLineDepth) {
                return fileLines;
            }
        }

        return fileLines;
    } 
                            #location 14 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static List<String> readFileLinesGuessEncoding(String filePath, int maxFileLineDepth) throws IOException {
        List<String> fileLines = new ArrayList<>();
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), guessCharset(new File(filePath))));

        try {
            String line;

            int lineCount = 0;
            while ((line = reader.readLine()) != null) {
                lineCount++;

                fileLines.add(line);

                if (lineCount == maxFileLineDepth) {
                    return fileLines;
                }
            }
        }
        finally {
            reader.close();
        }

        return fileLines;
    }