#vulnerable code 
                                public static List<String> readFileLines(String filePath, int maxFileLineDepth) throws FileNotFoundException {
        List<String> lines = new ArrayList<>();

        Scanner input = new Scanner(new File(filePath));

        int counter = 0;
        while(input.hasNextLine() && counter < maxFileLineDepth)
        {
            lines.add(input.nextLine());
            counter++;
        }

        return lines;
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static List<String> readFileLines(String filePath, int maxFileLineDepth) throws FileNotFoundException {
        List<String> lines = new ArrayList<>();
        Scanner input = new Scanner(new File(filePath));

        try {
            int counter = 0;
            while (input.hasNextLine() && counter < maxFileLineDepth) {
                lines.add(input.nextLine());
                counter++;
            }
        }
        finally {
            input.close();
        }

        return lines;
    }