#vulnerable code 
                                private String[] extendArgs(String file, String oldargs[], int offset)
            throws ArgumentParserException {
        List<String> list = new ArrayList<String>();
        BufferedReader reader;
        try {
            reader = new BufferedReader(new InputStreamReader(
                    new FileInputStream(file), "utf-8"));
            String line;
            while ((line = reader.readLine()) != null) {
                list.add(line);
            }
        } catch (IOException e) {
            throw new ArgumentParserException(String.format(
                    "Could not read arguments from file '%s'", file), e, this);
        }
        String newargs[] = new String[list.size() + oldargs.length - offset];
        list.toArray(newargs);
        System.arraycopy(oldargs, offset, newargs, list.size(), oldargs.length
                - offset);
        return newargs;
    } 
                            #location 12 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                private String[] extendArgs(String file, String oldargs[], int offset)
            throws ArgumentParserException {
        List<String> list = new ArrayList<String>();
        BufferedReader reader = null;
        try {
            reader = new BufferedReader(new InputStreamReader(
                    new FileInputStream(file), "utf-8"));
            String line;
            while ((line = reader.readLine()) != null) {
                list.add(line);
            }
        } catch (IOException e) {
            throw new ArgumentParserException(String.format(
                    "Could not read arguments from file '%s'", file), e, this);
        } finally {
            try {
                if(reader != null) {
                    reader.close();
                }
            } catch(IOException e) {}
        }
        String newargs[] = new String[list.size() + oldargs.length - offset];
        list.toArray(newargs);
        System.arraycopy(oldargs, offset, newargs, list.size(), oldargs.length
                - offset);
        return newargs;
    }