#vulnerable code 
                             @Test
	public void jcal_draft_example2() throws Throwable {
		//see: http://tools.ietf.org/html/draft-ietf-jcardcal-jcal-05#page-27
		//Note: all whitespace is removed from the expected JSON string it easier to compare it with the actual result
		VTimezone usEasternTz;
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setProductId("-//ExampleCorp.//ExampleClient//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("Wearehavingameetingallthisweekat12pmforonehour,withanadditionalmeetingonthefirstday2hourslong.\nPleasebringyourownlunchforthe12pmmeetings.");
			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-02T14: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");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}

		assertWarnings(0, ical.validate());
		assertExample(ical, "jcal-draft-example2.json");
	} 
                            #location 16 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                             @Test
	public void jcal_draft_example2() throws Throwable {
		//see: http://tools.ietf.org/html/draft-ietf-jcardcal-jcal-05#page-27
		//Note: all whitespace is removed from the expected JSON string it easier to compare it with the actual result
		VTimezone usEasternTz;
		ICalendar ical = new ICalendar();
		ical.getProperties().clear();
		ical.setProductId("-//ExampleCorp.//ExampleClient//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("Wearehavingameetingallthisweekat12pmforonehour,withanadditionalmeetingonthefirstday2hourslong.\nPleasebringyourownlunchforthe12pmmeetings.");
			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-02T14: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");
			event.setUid("00959BC664CA650E933C892C@example.com");
			ical.addEvent(event);
		}

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