#vulnerable code 
                                public void readDictionaryFromFile(String file, List<Integer> wordSizes) {

        for (int wordSize : wordSizes) {

            int wordCount = 0;

            IntVar[] list = new IntVar[wordSize];
            for (int i = 0; i < wordSize; i++)
                list[i] = blank;

            int[] tupleForGivenWord = new int[wordSize];
            MDD resultForWordSize = new MDD(list);

            try {

                BufferedReader inr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"));

                String str;
                while ((str = inr.readLine()) != null && str.length() > 0) {

                    str = str.trim();

                    // ignore comments
                    // starting with either # or %
                    if (str.startsWith("#") || str.startsWith("%")) {
                        continue;
                    }

                    if (str.length() != wordSize)
                        continue;

                    for (int i = 0; i < wordSize; i++) {
                        tupleForGivenWord[i] = mapping.get(str.substring(i, i + 1));
                    }

                    wordCount++;
                    resultForWordSize.addTuple(tupleForGivenWord);

                    //   				lineCount++;

                } // end while

                inr.close();

            } catch (IOException e) {
                System.out.println(e);
            }

            System.out.println("There are " + wordCount + " words of size " + wordSize);
            resultForWordSize.reduce();
            mdds.put(wordSize, resultForWordSize);
        }

    } 
                            #location 45 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void readDictionaryFromFile(String file, List<Integer> wordSizes) {

        for (int wordSize : wordSizes) {

            int wordCount = 0;

            IntVar[] list = new IntVar[wordSize];
            for (int i = 0; i < wordSize; i++)
                list[i] = blank;

            int[] tupleForGivenWord = new int[wordSize];
            MDD resultForWordSize = new MDD(list);

            try(BufferedReader inr = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-8"))) {

                String str;
                while ((str = inr.readLine()) != null && str.length() > 0) {

                    str = str.trim();

                    // ignore comments
                    // starting with either # or %
                    if (str.startsWith("#") || str.startsWith("%")) {
                        continue;
                    }

                    if (str.length() != wordSize)
                        continue;

                    for (int i = 0; i < wordSize; i++) {
                        tupleForGivenWord[i] = mapping.get(str.substring(i, i + 1));
                    }

                    wordCount++;
                    resultForWordSize.addTuple(tupleForGivenWord);

                    //   				lineCount++;

                } // end while

                inr.close();

            } catch (IOException e) {
                System.out.println(e);
            }

            System.out.println("There are " + wordCount + " words of size " + wordSize);
            resultForWordSize.reduce();
            mdds.put(wordSize, resultForWordSize);
        }

    }