#vulnerable code 
                             @Test
	public void override_marshaller() throws Exception {
		ICalendar ical = new ICalendar();

		StringWriter sw = new StringWriter();
		ICalWriter writer = new ICalWriter(sw);
		writer.registerMarshaller(new MyVersionMarshaller());
		writer.write(ical);
		writer.close();

		//@formatter:off
		String expected = 
		"BEGIN:VCALENDAR\r\n" +
			"VERSION:2\\.0 \\(beta\\)\r\n" +
			"PRODID:.*?\r\n" +
		"END:VCALENDAR\r\n";
		//@formatter:on

		String actual = sw.toString();
		assertRegex(expected, actual);
		assertWarnings(0, writer.getWarnings());
	} 
                            #location 22 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             @Test
	public void override_marshaller() throws Exception {
		ICalendar ical = new ICalendar();

		StringWriter sw = new StringWriter();
		ICalWriter writer = new ICalWriter(sw);
		writer.registerMarshaller(new MyVersionMarshaller());
		writer.write(ical);
		writer.close();

		//@formatter:off
		String expected = 
		"BEGIN:VCALENDAR\r\n" +
			"VERSION:2\\.0 \\(beta\\)\r\n" +
			"PRODID:.*?\r\n" +
		"END:VCALENDAR\r\n";
		//@formatter:on

		String actual = sw.toString();
		assertRegex(expected, actual);
	}