#vulnerable code 
                             private String[] fileToStringArray (File f, String encoding)
	{
		ArrayList<String> wordarray = new ArrayList<String>();

		try {

			BufferedReader input = null;
			if (encoding == null) {
				input = new BufferedReader (new FileReader (f));
			}
			else {
				input = new BufferedReader( new InputStreamReader( new FileInputStream(f), encoding ));
			}
			String line;

			while (( line = input.readLine()) != null) {
				String[] words = line.split ("\\s+");
				for (int i = 0; i < words.length; i++)
					wordarray.add (words[i]);
			}

		} catch (IOException e) {
			throw new IllegalArgumentException("Trouble reading file "+f);
		}
		return (String[]) wordarray.toArray(new String[]{});
	} 
                            #location 22 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             private String[] fileToStringArray (File f, String encoding)
	{
		try {
			return streamToStringArray(new FileInputStream(f), encoding);
		} catch (IOException e) {
			throw new IllegalArgumentException("Trouble reading file "+f);
		}
	}