#vulnerable code 
                                public void readFromFile(String filename) {

        String lines[] = new String[100];

        int[] dimensions = new int[2];

		/* read from file args[0] or qcp.txt */
        try {

            BufferedReader in = new BufferedReader(new FileReader(filename));
            String str;

            str = in.readLine();

            Pattern pat = Pattern.compile(" ");
            String[] result = pat.split(str);

            int current = 0;
            for (int j = 0; j < result.length; j++)
                try {
                    int currentNo = Integer.parseInt(result[j]);
                    dimensions[current++] = currentNo;
                } catch (Exception ex) {

                }

            lines = new String[dimensions[0] + dimensions[1]];

            int n = 0;

            while ((str = in.readLine()) != null && n < lines.length) {
                lines[n] = str;
                n++;
            }
            in.close();
        } catch (FileNotFoundException e) {
            System.err.println("I can not find file " + filename);
        } catch (IOException e) {
            System.err.println("Something is wrong with file" + filename);
        }

        row_rules = new int[dimensions[1]][];
        col_rules = new int[dimensions[0]][];

        // Transforms strings into ints
        for (int i = 0; i < lines.length; i++) {

            Pattern pat = Pattern.compile(" ");
            String[] result = pat.split(lines[i]);

            int[] sequence = new int[result.length];

            int current = 0;
            for (int j = 0; j < result.length; j++)
                try {
                    sequence[current++] = Integer.parseInt(result[j]);
                } catch (Exception ex) {
                }

            if (i < row_rules.length)
                row_rules[i] = sequence;
            else
                col_rules[i - row_rules.length] = sequence;
        }

    } 
                            #location 36 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public void readFromFile(String filename) {

        String lines[] = new String[100];

        int[] dimensions = new int[2];

		/* read from file args[0] or qcp.txt */
        try {
            
            BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
            String str;

            str = in.readLine();

            Pattern pat = Pattern.compile(" ");
            String[] result = pat.split(str);

            int current = 0;
            for (int j = 0; j < result.length; j++)
                try {
                    int currentNo = Integer.parseInt(result[j]);
                    dimensions[current++] = currentNo;
                } catch (Exception ex) {

                }

            lines = new String[dimensions[0] + dimensions[1]];

            int n = 0;

            while ((str = in.readLine()) != null && n < lines.length) {
                lines[n] = str;
                n++;
            }
            in.close();
        } catch (FileNotFoundException e) {
            System.err.println("I can not find file " + filename);
        } catch (IOException e) {
            System.err.println("Something is wrong with file" + filename);
        }

        row_rules = new int[dimensions[1]][];
        col_rules = new int[dimensions[0]][];

        // Transforms strings into ints
        for (int i = 0; i < lines.length; i++) {

            Pattern pat = Pattern.compile(" ");
            String[] result = pat.split(lines[i]);

            int[] sequence = new int[result.length];

            int current = 0;
            for (int j = 0; j < result.length; j++)
                try {
                    sequence[current++] = Integer.parseInt(result[j]);
                } catch (Exception ex) {
                }

            if (i < row_rules.length)
                row_rules[i] = sequence;
            else
                col_rules[i - row_rules.length] = sequence;
        }

    }