#vulnerable code 
                             @Test
	public void jcal_draft_example1() throws Throwable {
		//see: http://tools.ietf.org/html/draft-ietf-jcardcal-jcal-05#page-25
		//Note: all whitespace is removed from the expected JSON string it easier to compare it with the actual result
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setCalendarScale(CalendarScale.gregorian());
		ical.setProductId("-//ExampleInc.//ExampleCalendar//EN");
		ical.setVersion(Version.v2_0());
		{
			VEvent event = new VEvent();
			event.getProperties().clear();
			event.setDateTimeStamp(utcFormatter.parse("2008-02-05T19:12:24"));
			event.setDateStart(new DateStart(dateFormatter.parse("2008-10-06"), false));
			event.setSummary("Planningmeeting");
			event.setUid("4088E990AD89CB3DBB484909");
			ical.addEvent(event);
		}

		assertWarnings(0, ical.validate());

		StringWriter sw = new StringWriter();
		JCalWriter writer = new JCalWriter(sw);
		writer.write(ical);
		writer.close();

		String expected = new String(IOUtils.toByteArray(getClass().getResourceAsStream("jcal-draft-example1.json")));
		expected = expected.replaceAll("\\s", "");
		String actual = sw.toString();
		assertEquals(expected, actual);
	} 
                            #location 18 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             @Test
	public void jcal_draft_example1() throws Throwable {
		//see: http://tools.ietf.org/html/draft-ietf-jcardcal-jcal-05#page-25
		//Note: all whitespace is removed from the expected JSON string it easier to compare it with the actual result
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setCalendarScale(CalendarScale.gregorian());
		ical.setProductId("-//ExampleInc.//ExampleCalendar//EN");
		ical.setVersion(Version.v2_0());
		{
			VEvent event = new VEvent();
			event.getProperties().clear();
			event.setDateTimeStamp(utcFormatter.parse("2008-02-05T19:12:24"));
			event.setDateStart(new DateStart(dateFormatter.parse("2008-10-06"), false));
			event.setSummary("Planningmeeting");
			event.setUid("4088E990AD89CB3DBB484909");
			ical.addEvent(event);
		}

		assertWarnings(0, ical.validate());
		assertExample(ical, "jcal-draft-example1.json");
	}