#fixed code
                             @Test
	public void write_example2() throws Throwable {
		//see: RFC 6321 p.51
		VTimezone usEasternTz;
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setProductId("-//Example Inc.//Example Client//EN");
		ical.setVersion(Version.v2_0());
		{
			usEasternTz = new VTimezone(null);
			usEasternTz.setLastModified(utcFormatter.parse("2004-01-10T03:28:45"));
			usEasternTz.setTimezoneId("US/Eastern");
			{
				DaylightSavingsTime daylight = new DaylightSavingsTime();
				daylight.setDateStart(localFormatter.parse("2000-04-04T02:00:00"));

				RecurrenceRule rrule = new RecurrenceRule(Frequency.YEARLY);
				rrule.addByDay(1, DayOfWeek.SUNDAY);
				rrule.addByMonth(4);
				daylight.setRecurrenceRule(rrule);

				daylight.addTimezoneName("EDT");
				daylight.setTimezoneOffsetFrom(-5, 0);
				daylight.setTimezoneOffsetTo(-4, 0);

				usEasternTz.addDaylightSavingsTime(daylight);
			}
			{
				StandardTime standard = new StandardTime();
				standard.setDateStart(localFormatter.parse("2000-10-26T02:00:00"));

				RecurrenceRule rrule = new RecurrenceRule(Frequency.YEARLY);
				rrule.addByDay(-1, DayOfWeek.SUNDAY);
				rrule.addByMonth(10);
				standard.setRecurrenceRule(rrule);

				standard.addTimezoneName("EST");
				standard.setTimezoneOffsetFrom(-4, 0);
				standard.setTimezoneOffsetTo(-5, 0);

				usEasternTz.addStandardTime(standard);
			}
			ical.addTimezone(usEasternTz);
		}
		{
			VEvent event = new VEvent();
			event.setDateTimeStamp(utcFormatter.parse("2006-02-06T00:11:21"));
			event.setDateStart(usEasternFormatter.parse("2006-01-02T12:00:00")).setTimezone(usEasternTz);
			event.setDuration(new Duration.Builder().hours(1).build());

			RecurrenceRule rrule = new RecurrenceRule(Frequency.DAILY);
			rrule.setCount(5);
			event.setRecurrenceRule(rrule);

			RecurrenceDates rdate = new RecurrenceDates(Arrays.asList(new Period(usEasternFormatter.parse("2006-01-02T15:00:00"), new Duration.Builder().hours(2).build())));
			rdate.setTimezone(usEasternTz);
			event.addRecurrenceDates(rdate);

			event.setSummary("Event #2");
			event.setDescription("We are having a meeting all this week at 12pm for one hour, with an additional meeting on the first day 2 hours long.\nPlease bring your own lunch for the 12 pm meetings.");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}
		{
			VEvent event = new VEvent();
			event.setDateTimeStamp(utcFormatter.parse("2006-02-06T00:11:21"));
			event.setDateStart(usEasternFormatter.parse("2006-01-04T14:00:00")).setTimezone(usEasternTz);
			event.setDuration(new Duration.Builder().hours(1).build());

			event.setRecurrenceId(usEasternFormatter.parse("2006-01-04T12:00:00")).setTimezone(usEasternTz);

			event.setSummary("Event #2 bis");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}

		assertWarnings(0, ical.validate());
		assertExample(ical, "rfc6321-example2.xml");
	}
#vulnerable code 
                             @Test
	public void write_example2() throws Throwable {
		//see: RFC 6321 p.51
		VTimezone usEasternTz;
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setProductId("-//Example Inc.//Example Client//EN");
		ical.setVersion(Version.v2_0());
		{
			usEasternTz = new VTimezone(null);
			usEasternTz.setLastModified(utcFormatter.parse("2004-01-10T03:28:45"));
			usEasternTz.setTimezoneId("US/Eastern");
			{
				DaylightSavingsTime daylight = new DaylightSavingsTime();
				daylight.setDateStart(localFormatter.parse("2000-04-04T02:00:00")).setLocalTime(true);

				RecurrenceRule rrule = new RecurrenceRule(Frequency.YEARLY);
				rrule.addByDay(1, DayOfWeek.SUNDAY);
				rrule.addByMonth(4);
				daylight.setRecurrenceRule(rrule);

				daylight.addTimezoneName("EDT");
				daylight.setTimezoneOffsetFrom(-5, 0);
				daylight.setTimezoneOffsetTo(-4, 0);

				usEasternTz.addDaylightSavingsTime(daylight);
			}
			{
				StandardTime standard = new StandardTime();
				standard.setDateStart(localFormatter.parse("2000-10-26T02:00:00")).setLocalTime(true);

				RecurrenceRule rrule = new RecurrenceRule(Frequency.YEARLY);
				rrule.addByDay(-1, DayOfWeek.SUNDAY);
				rrule.addByMonth(10);
				standard.setRecurrenceRule(rrule);

				standard.addTimezoneName("EST");
				standard.setTimezoneOffsetFrom(-4, 0);
				standard.setTimezoneOffsetTo(-5, 0);

				usEasternTz.addStandardTime(standard);
			}
			ical.addTimezone(usEasternTz);
		}
		{
			VEvent event = new VEvent();
			event.setDateTimeStamp(utcFormatter.parse("2006-02-06T00:11:21"));
			event.setDateStart(usEasternFormatter.parse("2006-01-02T12:00:00")).setTimezone(usEasternTz);
			event.setDuration(new Duration.Builder().hours(1).build());

			RecurrenceRule rrule = new RecurrenceRule(Frequency.DAILY);
			rrule.setCount(5);
			event.setRecurrenceRule(rrule);

			RecurrenceDates rdate = new RecurrenceDates(Arrays.asList(new Period(usEasternFormatter.parse("2006-01-02T15:00:00"), new Duration.Builder().hours(2).build())));
			rdate.setTimezone(usEasternTz);
			event.addRecurrenceDates(rdate);

			event.setSummary("Event #2");
			event.setDescription("We are having a meeting all this week at 12pm for one hour, with an additional meeting on the first day 2 hours long.\nPlease bring your own lunch for the 12 pm meetings.");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}
		{
			VEvent event = new VEvent();
			event.setDateTimeStamp(utcFormatter.parse("2006-02-06T00:11:21"));
			event.setDateStart(usEasternFormatter.parse("2006-01-04T14:00:00")).setTimezone(usEasternTz);
			event.setDuration(new Duration.Builder().hours(1).build());

			event.setRecurrenceId(usEasternFormatter.parse("2006-01-04T12:00:00")).setTimezone(usEasternTz);

			event.setSummary("Event #2 bis");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}

		assertWarnings(0, ical.validate());
		assertExample(ical, "rfc6321-example2.xml");
	} 
                            #location 15 
                            #vulnerability type NULL_DEREFERENCE