#fixed code
                             private int getCommentsAmount(File file) throws IOException {

		if (!file.exists())
			return 0;
		int comments = 0;
		String currentLine;

		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new FileReader(file));
			while ((currentLine = reader.readLine()) != null)
				if (currentLine.startsWith("#"))
					comments++;

			return comments;
		} catch (IOException e) {
			throw e;
		} finally {
			if (reader != null)
				reader.close();
		}
	}
#vulnerable code 
                             private int getCommentsAmount(File file) throws IOException {

		if (!file.exists())
			return 0;
		int comments = 0;
		String currentLine;

		BufferedReader reader = new BufferedReader(new FileReader(file));

		while ((currentLine = reader.readLine()) != null)
			if (currentLine.startsWith("#"))
				comments++;

		reader.close();
		return comments;
	} 
                            #location 15 
                            #vulnerability type RESOURCE_LEAK