# HG changeset patch # User Michael Schloh von Bennewitz # Date 1423593480 -3600 # Node ID 73bdfa70b04eb06d11d7197a35e70e6aa2d3d9c5 # Parent dee028db6e9bff15499fb09401fc747bbe0a5ba4 Upgrade embedded ical4j from ancient whatever to upstream version 1.0.6. diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/data/CalendarParserImpl.java --- a/src/net/fortuna/ical4j/data/CalendarParserImpl.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/data/CalendarParserImpl.java Tue Feb 10 19:38:00 2015 +0100 @@ -177,7 +177,7 @@ else { propertyParser.parse(tokeniser, in, handler); } - absorbWhitespace(tokeniser); + absorbWhitespace(tokeniser, in); // assertToken(tokeniser, StreamTokenizer.TT_WORD); } } @@ -228,10 +228,9 @@ // text = *(TSAFE-CHAR / ":" / DQUOTE / ESCAPED-CHAR) // tokeniser.ordinaryChar('"'); - int nextToken = tokeniser.nextToken(); + int nextToken = nextToken(tokeniser, in); - while (nextToken != StreamTokenizer.TT_EOL - && nextToken != StreamTokenizer.TT_EOF) { + while (nextToken != StreamTokenizer.TT_EOL) { if (tokeniser.ttype == StreamTokenizer.TT_WORD) { value.append(tokeniser.sval); @@ -240,17 +239,12 @@ value.append((char) tokeniser.ttype); } - nextToken = tokeniser.nextToken(); + nextToken = nextToken(tokeniser, in); } // reset DQUOTE to be quote char tokeniser.quoteChar('"'); - if (nextToken == StreamTokenizer.TT_EOF) { - throw new ParserException("Unexpected end of file", - getLineNumber(tokeniser, in)); - } - try { handler.propertyValue(value.toString()); } @@ -279,7 +273,7 @@ final ContentHandler handler) throws IOException, ParserException, URISyntaxException { - while (tokeniser.nextToken() == ';') { + while (nextToken(tokeniser, in) == ';') { paramParser.parse(tokeniser, in, handler); } } @@ -312,7 +306,7 @@ final StringBuffer paramValue = new StringBuffer(); // preserve quote chars.. - if (tokeniser.nextToken() == '"') { + if (nextToken(tokeniser, in) == '"') { paramValue.append('"'); paramValue.append(tokeniser.sval); paramValue.append('"'); @@ -320,7 +314,7 @@ else if (tokeniser.sval != null) { paramValue.append(tokeniser.sval); // check for additional words to account for equals (=) in param-value - int nextToken = tokeniser.nextToken(); + int nextToken = nextToken(tokeniser, in); while (nextToken != ';' && nextToken != ':' && nextToken != ',') { @@ -331,7 +325,7 @@ paramValue.append((char) tokeniser.ttype); } - nextToken = tokeniser.nextToken(); + nextToken = nextToken(tokeniser, in); } tokeniser.pushBack(); } else if(tokeniser.sval == null) { @@ -363,7 +357,7 @@ while (Component.BEGIN.equals(tokeniser.sval)) { componentParser.parse(tokeniser, in, handler); - absorbWhitespace(tokeniser); + absorbWhitespace(tokeniser, in); // assertToken(tokeniser, StreamTokenizer.TT_WORD); } } @@ -429,7 +423,7 @@ private void assertToken(final StreamTokenizer tokeniser, Reader in, final int token) throws IOException, ParserException { - if (tokeniser.nextToken() != token) { + if (nextToken(tokeniser, in) != token) { throw new ParserException(MessageFormat.format(UNEXPECTED_TOKEN_MESSAGE, new Object[] { new Integer(token), new Integer(tokeniser.ttype), }), getLineNumber(tokeniser, in)); @@ -489,9 +483,9 @@ * @param tokeniser * @throws IOException */ - private void absorbWhitespace(final StreamTokenizer tokeniser) throws IOException { + private void absorbWhitespace(final StreamTokenizer tokeniser, Reader in) throws IOException, ParserException { // HACK: absorb extraneous whitespace between components (KOrganizer).. - while (tokeniser.nextToken() == StreamTokenizer.TT_EOL) { + while (nextToken(tokeniser, in) == StreamTokenizer.TT_EOL) { if (log.isTraceEnabled()) { log.trace("Absorbing extra whitespace.."); } @@ -518,4 +512,20 @@ } return line; } + + /** + * Reads the next token from the tokeniser. + * This method throws a ParseException when reading EOF. + * @param tokeniser + * @param in + * @return + * @throws ParseException When reading EOF. + */ + private int nextToken(StreamTokenizer tokeniser, Reader in) throws IOException, ParserException { + int token = tokeniser.nextToken(); + if (token == StreamTokenizer.TT_EOF) { + throw new ParserException("Unexpected end of file", getLineNumber(tokeniser, in)); + } + return token; + } } diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/ComponentList.java --- a/src/net/fortuna/ical4j/model/ComponentList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/ComponentList.java Tue Feb 10 19:38:00 2015 +0100 @@ -124,7 +124,7 @@ * Add a component to the list. * @param component the component to add * @return true - * @see List#add(java.lang.Object) + * @see java.util.List#add(Object) */ public final boolean add(final Component component) { return add((Object) component); @@ -135,7 +135,7 @@ * net.fortuna.ical4j.model.Component. * @param component a component to add * @return true if the object was added, otherwise false - * @see List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object component) { if (!(component instanceof Component)) { @@ -147,14 +147,14 @@ /** * @return boolean indicates if the list is empty - * @see List#isEmpty() + * @see java.util.List#isEmpty() */ // public final boolean isEmpty() { // return components.isEmpty(); // } /** * @return an iterator - * @see List#iterator() + * @see java.util.List#iterator() */ // public final Iterator iterator() { // return components.iterator(); @@ -163,7 +163,7 @@ * Remove a component from the list. * @param component the component to remove * @return true if the list contained the specified component - * @see List#remove(java.lang.Object) + * @see java.util.List#remove(java.lang.Object) */ public final boolean remove(final Component component) { return remove((Object) component); @@ -171,7 +171,7 @@ /** * @return the number of components in the list - * @see List#size() + * @see java.util.List#size() */ // public final int size() { // return components.size(); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/Date.java --- a/src/net/fortuna/ical4j/model/Date.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/Date.java Tue Feb 10 19:38:00 2015 +0100 @@ -31,9 +31,12 @@ */ package net.fortuna.ical4j.model; +import java.text.DateFormat; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.TimeZone; +import net.fortuna.ical4j.util.CompatibilityHints; import net.fortuna.ical4j.util.Dates; import net.fortuna.ical4j.util.TimeZones; @@ -87,13 +90,15 @@ private static final long serialVersionUID = 7136072363141363141L; - private static final String PATTERN = "yyyyMMdd"; + private static final String DEFAULT_PATTERN = "yyyyMMdd"; + + private static final String VCARD_PATTERN = "yyyy'-'MM'-'dd"; /** * Default constructor. */ public Date() { - super(PATTERN, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); + super(DEFAULT_PATTERN, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); } /** @@ -105,14 +110,14 @@ * @see Dates#PRECISION_SECOND */ protected Date(final int precision, TimeZone tz) { - super(PATTERN, precision, tz); + super(DEFAULT_PATTERN, precision, tz); } /** * @param time a date value in milliseconds */ public Date(final long time) { - super(time, PATTERN, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); + super(time, DEFAULT_PATTERN, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); } /** @@ -125,7 +130,7 @@ * @see Dates#PRECISION_SECOND */ protected Date(final long time, final int precision, TimeZone tz) { - super(time, PATTERN, precision, tz); + super(time, DEFAULT_PATTERN, precision, tz); } /** @@ -143,7 +148,18 @@ */ public Date(final String value) throws ParseException { this(); - setTime(getFormat().parse(value).getTime()); + try { + setTime(getFormat().parse(value).getTime()); + } catch (ParseException pe) { + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { + final DateFormat parseFormat = new SimpleDateFormat(VCARD_PATTERN); + parseFormat.setTimeZone(TimeZones.getDateTimeZone()); + setTime(parseFormat.parse(value).getTime()); + } + else { + throw pe; + } + } } /** @@ -152,7 +168,9 @@ * @throws ParseException where the specified string is not a valid date */ public Date(String value, String pattern) throws ParseException { - super(pattern, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); - setTime(getFormat().parse(value).getTime()); + super(DEFAULT_PATTERN, Dates.PRECISION_DAY, TimeZones.getDateTimeZone()); + final DateFormat parseFormat = new SimpleDateFormat(pattern); + parseFormat.setTimeZone(TimeZones.getDateTimeZone()); + setTime(parseFormat.parse(value).getTime()); } } diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/DateList.java --- a/src/net/fortuna/ical4j/model/DateList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/DateList.java Tue Feb 10 19:38:00 2015 +0100 @@ -195,7 +195,7 @@ * timezone of this list. * @param date the date to add * @return true - * @see List#add(java.lang.Object) + * @see java.util.List#add(Object) */ public final boolean add(final Date date) { if (date instanceof DateTime) { @@ -219,7 +219,7 @@ * Where argument is not a net.fortuna.ical4j.model.Date. * @param date the date to add * @return true if the object was added, otherwise false - * @see List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object date) { if (!(date instanceof Date)) { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/DateTime.java --- a/src/net/fortuna/ical4j/model/DateTime.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/DateTime.java Tue Feb 10 19:38:00 2015 +0100 @@ -42,7 +42,6 @@ import net.fortuna.ical4j.util.TimeZones; import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; /** * $Id$ @@ -161,6 +160,8 @@ private static final String DEFAULT_PATTERN = "yyyyMMdd'T'HHmmss"; private static final String UTC_PATTERN = "yyyyMMdd'T'HHmmss'Z'"; + + private static final String VCARD_PATTERN = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"; private static final String RELAXED_PATTERN = "yyyyMMdd"; @@ -195,10 +196,16 @@ private static final DateFormatCache RELAXED_FORMAT; static { final DateFormat format = new SimpleDateFormat(RELAXED_PATTERN); - format.setLenient(false); + format.setLenient(true); RELAXED_FORMAT = new DateFormatCache(format); } + private static final DateFormatCache VCARD_FORMAT; + static { + final DateFormat format = new SimpleDateFormat(VCARD_PATTERN); + VCARD_FORMAT = new DateFormatCache(format); + } + private Time time; private TimeZone timezone; @@ -305,8 +312,18 @@ setTimeZone(timezone); } } catch (ParseException pe) { - if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { + try { + setTime(value, (DateFormat) VCARD_FORMAT.get(), timezone); + setTimeZone(timezone); + } catch (ParseException pe2) { + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { + setTime(value, (DateFormat) RELAXED_FORMAT.get(), timezone); + setTimeZone(timezone); + } + } + } else if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { setTime(value, (DateFormat) RELAXED_FORMAT.get(), timezone); setTimeZone(timezone); } else { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/Iso8601.java --- a/src/net/fortuna/ical4j/model/Iso8601.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/Iso8601.java Tue Feb 10 19:38:00 2015 +0100 @@ -112,21 +112,22 @@ public String toString() { // if time is floating avoid daylight saving rules when generating // string representation of date.. - if (!(format.getTimeZone() instanceof TimeZone)) { + final java.util.TimeZone timeZone = format.getTimeZone(); + if (!(timeZone instanceof TimeZone)) { if (gmtFormat == null) { gmtFormat = (DateFormat) format.clone(); gmtFormat.setTimeZone(TimeZone.getTimeZone(TimeZones.GMT_ID)); } - if (format.getTimeZone().inDaylightTime(this) - && format.getTimeZone().inDaylightTime(new Date(getTime() - 1))) { - + if (timeZone.inDaylightTime(this) + && timeZone.inDaylightTime(new Date(getTime() - 1))) { + return gmtFormat.format(new Date(getTime() - + format.getTimeZone().getRawOffset() - + format.getTimeZone().getDSTSavings())); + + timeZone.getRawOffset() + + timeZone.getDSTSavings())); // return format.format(new Date(getTime() - format.getTimeZone().getDSTSavings())); } // return gmtFormat.format(new Date(getTime() + format.getTimeZone().getOffset(getTime()))); - return gmtFormat.format(new Date(getTime() + format.getTimeZone().getRawOffset())); + return gmtFormat.format(new Date(getTime() + timeZone.getRawOffset())); } return format.format(this); } diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/NumberList.java --- a/src/net/fortuna/ical4j/model/NumberList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/NumberList.java Tue Feb 10 19:38:00 2015 +0100 @@ -121,7 +121,7 @@ * where argument is not a java.lang.Integer. * @param arg0 an object to add * @return true if the object was added, otherwise false - * @see List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object arg0) { if (!(arg0 instanceof Integer)) { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/PeriodList.java --- a/src/net/fortuna/ical4j/model/PeriodList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/PeriodList.java Tue Feb 10 19:38:00 2015 +0100 @@ -146,7 +146,7 @@ * where argument is not a net.fortuna.ical4j.model.Period. * @param period a period to add to the list * @return true if the period was added, otherwise false - * @see java.util.List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object period) { if (!(period instanceof Period)) { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/PropertyFactoryImpl.java --- a/src/net/fortuna/ical4j/model/PropertyFactoryImpl.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/PropertyFactoryImpl.java Tue Feb 10 19:38:00 2015 +0100 @@ -365,9 +365,6 @@ } } - /** - * @return - */ private static class DtStartFactory implements PropertyFactory { private static final long serialVersionUID = 1L; diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/PropertyList.java --- a/src/net/fortuna/ical4j/model/PropertyList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/PropertyList.java Tue Feb 10 19:38:00 2015 +0100 @@ -134,7 +134,7 @@ * net.fortuna.ical4j.model.Property. * @param property a property to add * @return true if the property is added, otherwise false - * @see java.util.List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object property) { if (!(property instanceof Property)) { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/Recur.java --- a/src/net/fortuna/ical4j/model/Recur.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/Recur.java Tue Feb 10 19:38:00 2015 +0100 @@ -44,6 +44,7 @@ import java.util.StringTokenizer; import net.fortuna.ical4j.model.parameter.Value; +import net.fortuna.ical4j.util.CompatibilityHints; import net.fortuna.ical4j.util.Configurator; import net.fortuna.ical4j.util.Dates; @@ -171,6 +172,8 @@ private NumberList setPosList; private String weekStartDay; + + private int calendarWeekStartDay; private Map experimentalValues = new HashMap(); @@ -181,6 +184,8 @@ * Default constructor. */ public Recur() { + // default week start is Monday per RFC5545 + calendarWeekStartDay = Calendar.MONDAY; } /** @@ -189,6 +194,8 @@ * @throws ParseException thrown when the specified string contains an invalid representation of an UNTIL date value */ public Recur(final String aValue) throws ParseException { + // default week start is Monday per RFC5545 + calendarWeekStartDay = Calendar.MONDAY; final StringTokenizer t = new StringTokenizer(aValue, ";="); while (t.hasMoreTokens()) { final String token = t.nextToken(); @@ -241,10 +248,17 @@ } else if (WKST.equals(token)) { weekStartDay = nextToken(t, token); + calendarWeekStartDay = WeekDay.getCalendarDay(new WeekDay(weekStartDay)); } - // assume experimental value.. else { - experimentalValues.put(token, nextToken(t, token)); + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { + // assume experimental value.. + experimentalValues.put(token, nextToken(t, token)); + } + else { + throw new IllegalArgumentException("Invalid recurrence rule part: " + + token + "=" + nextToken(t, token)); + } } } validateFrequency(); @@ -264,6 +278,8 @@ * @param until maximum recurrence date */ public Recur(final String frequency, final Date until) { + // default week start is Monday per RFC5545 + calendarWeekStartDay = Calendar.MONDAY; this.frequency = frequency; this.until = until; validateFrequency(); @@ -274,6 +290,8 @@ * @param count maximum recurrence count */ public Recur(final String frequency, final int count) { + // default week start is Monday per RFC5545 + calendarWeekStartDay = Calendar.MONDAY; this.frequency = frequency; this.count = count; validateFrequency(); @@ -416,6 +434,9 @@ */ public final void setWeekStartDay(final String weekStartDay) { this.weekStartDay = weekStartDay; + if (weekStartDay != null) { + calendarWeekStartDay = WeekDay.getCalendarDay(new WeekDay(weekStartDay)); + } } /** @@ -578,8 +599,7 @@ dates.setTimeZone(((DateTime) seed).getTimeZone()); } } - final Calendar cal = Dates.getCalendarInstance(seed); - cal.setTime(seed); + final Calendar cal = getCalendarInstance(seed, true); // optimize the start time for selecting candidates // (only applicable where a COUNT is not specified) @@ -670,8 +690,7 @@ */ public final Date getNextDate(final Date seed, final Date startDate) { - final Calendar cal = Dates.getCalendarInstance(seed); - cal.setTime(seed); + final Calendar cal = getCalendarInstance(seed, true); // optimize the start time for selecting candidates // (only applicable where a COUNT is not specified) @@ -857,8 +876,8 @@ final DateList monthlyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); + for (final Iterator j = getMonthList().iterator(); j.hasNext();) { final Integer month = (Integer) j.next(); // Java months are zero-based.. @@ -883,8 +902,7 @@ final DateList weekNoDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); for (final Iterator j = getWeekNoList().iterator(); j.hasNext();) { final Integer weekNo = (Integer) j.next(); cal.set(Calendar.WEEK_OF_YEAR, Dates.getAbsWeekNo(cal.getTime(), weekNo.intValue())); @@ -907,8 +925,7 @@ final DateList yearDayDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); for (final Iterator j = getYearDayList().iterator(); j.hasNext();) { final Integer yearDay = (Integer) j.next(); cal.set(Calendar.DAY_OF_YEAR, Dates.getAbsYearDay(cal.getTime(), yearDay.intValue())); @@ -931,9 +948,7 @@ final DateList monthDayDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setLenient(false); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, false); for (final Iterator j = getMonthDayList().iterator(); j.hasNext();) { final Integer monthDay = (Integer) j.next(); try { @@ -969,8 +984,7 @@ // if BYYEARDAY or BYMONTHDAY is specified filter existing // list.. if (!getYearDayList().isEmpty() || !getMonthDayList().isEmpty()) { - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); if (weekDay.equals(WeekDay.getWeekDay(cal))) { weekDayDates.add(date); } @@ -991,15 +1005,7 @@ * @return */ private List getAbsWeekDays(final Date date, final Value type, final WeekDay weekDay) { - final Calendar cal = Dates.getCalendarInstance(date); - // default week start is Monday per RFC5545 - int calendarWeekStartDay = Calendar.MONDAY; - if (weekStartDay != null) { - calendarWeekStartDay = WeekDay.getCalendarDay(new WeekDay(weekStartDay)); - } - cal.setFirstDayOfWeek(calendarWeekStartDay); - cal.setTime(date); - + final Calendar cal = getCalendarInstance(date, true); final DateList days = new DateList(type); if (date instanceof DateTime) { if (((DateTime) date).isUtc()) { @@ -1095,8 +1101,7 @@ final DateList hourlyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); for (final Iterator j = getHourList().iterator(); j.hasNext();) { final Integer hour = (Integer) j.next(); cal.set(Calendar.HOUR_OF_DAY, hour.intValue()); @@ -1119,8 +1124,7 @@ final DateList minutelyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); for (final Iterator j = getMinuteList().iterator(); j.hasNext();) { final Integer minute = (Integer) j.next(); cal.set(Calendar.MINUTE, minute.intValue()); @@ -1143,8 +1147,7 @@ final DateList secondlyDates = getDateListInstance(dates); for (final Iterator i = dates.iterator(); i.hasNext();) { final Date date = (Date) i.next(); - final Calendar cal = Dates.getCalendarInstance(date); - cal.setTime(date); + final Calendar cal = getCalendarInstance(date, true); for (final Iterator j = getSecondList().iterator(); j.hasNext();) { final Integer second = (Integer) j.next(); cal.set(Calendar.SECOND, second.intValue()); @@ -1218,6 +1221,23 @@ } /** + * Construct a Calendar object and sets the time. + * @param date + * @param lenient + * @return + */ + private Calendar getCalendarInstance(final Date date, final boolean lenient) { + Calendar cal = Dates.getCalendarInstance(date); + // A week should have at least 4 days to be considered as such per RFC5545 + cal.setMinimalDaysInFirstWeek(4); + cal.setFirstDayOfWeek(calendarWeekStartDay); + cal.setLenient(lenient); + cal.setTime(date); + + return cal; + } + + /** * @param stream * @throws IOException * @throws ClassNotFoundException @@ -1233,7 +1253,7 @@ * @param origList * @return a new empty list. */ - private static final DateList getDateListInstance(final DateList origList) { + private static DateList getDateListInstance(final DateList origList) { final DateList list = new DateList(origList.getType()); if (origList.isUtc()) { list.setUtc(true); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/TimeZone.java --- a/src/net/fortuna/ical4j/model/TimeZone.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/TimeZone.java Tue Feb 10 19:38:00 2015 +0100 @@ -72,16 +72,27 @@ /** * {@inheritDoc} */ - public final int getOffset(final int era, final int year, final int month, final int day, + public final int getOffset(final int era, final int year, final int month, final int dayOfMonth, final int dayOfWeek, final int milliseconds) { + + // calculate time of day + int ms = milliseconds; + final int hour = ms / 3600000; + ms -= hour*3600000; + final int minute = ms / 60000; + ms -= minute*60000; + final int second = ms / 1000; + ms -= second*1000; + + final Calendar cal = Calendar.getInstance(); + cal.clear(); // don't retain current date/time, it may disturb the calculation - final Calendar cal = Calendar.getInstance(); + // set date and time cal.set(Calendar.ERA, era); - cal.set(Calendar.YEAR, year); - cal.set(Calendar.MONTH, month); - cal.set(Calendar.DAY_OF_YEAR, day); cal.set(Calendar.DAY_OF_WEEK, dayOfWeek); - cal.set(Calendar.MILLISECOND, milliseconds); + cal.set(year, month, dayOfMonth, hour, minute, second); + cal.set(Calendar.MILLISECOND, ms); + final Observance observance = vTimeZone.getApplicableObservance(new DateTime(cal.getTime())); if (observance != null) { final TzOffsetTo offset = (TzOffsetTo) observance.getProperty(Property.TZOFFSETTO); @@ -97,7 +108,12 @@ final Observance observance = vTimeZone.getApplicableObservance(new DateTime(date)); if (observance != null) { final TzOffsetTo offset = (TzOffsetTo) observance.getProperty(Property.TZOFFSETTO); - return (int) offset.getOffset().getOffset(); + if (offset.getOffset().getOffset() < getRawOffset()) { + return getRawOffset(); + } + else { + return (int) offset.getOffset().getOffset(); + } } return 0; } @@ -145,26 +161,34 @@ } private static final int getRawOffset(VTimeZone vt) { - // per spec, rawoffset is the raw offset at the current date - final DateTime now = new DateTime(); List seasonalTimes = vt.getObservances().getComponents(Observance.STANDARD); // if no standard time use daylight time.. - if (seasonalTimes.size() == 0) { + if (seasonalTimes.isEmpty()) { seasonalTimes = vt.getObservances().getComponents(Observance.DAYLIGHT); + if (seasonalTimes.isEmpty()) { + return 0; + } } Observance latestSeasonalTime = null; - Date latestOnset = null; - for (int i = 0; i < seasonalTimes.size(); i++) { - Observance seasonalTime = (Observance) seasonalTimes.get(i); - Date onset = seasonalTime.getLatestOnset(now); - if (onset == null) { - continue; + if (seasonalTimes.size() > 1) { + // per java spec and when dealing with historical time, + // rawoffset is the raw offset at the current date + final DateTime now = new DateTime(); + Date latestOnset = null; + for (int i = 0; i < seasonalTimes.size(); i++) { + Observance seasonalTime = (Observance) seasonalTimes.get(i); + Date onset = seasonalTime.getLatestOnset(now); + if (onset == null) { + continue; + } + if (latestOnset == null || onset.after(latestOnset)) { + latestOnset = onset; + latestSeasonalTime = seasonalTime; + } } - if (latestOnset == null || onset.after(latestOnset)) { - latestOnset = onset; - latestSeasonalTime = seasonalTime; - } + } else { + latestSeasonalTime = (Observance)seasonalTimes.get(0); } if (latestSeasonalTime != null) { final TzOffsetTo offsetTo = (TzOffsetTo) latestSeasonalTime.getProperty(Property.TZOFFSETTO); @@ -174,4 +198,22 @@ } return 0; } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + TimeZone timeZone = (TimeZone) o; + + if (rawOffset != timeZone.rawOffset) return false; + if (vTimeZone != null ? !vTimeZone.equals(timeZone.vTimeZone) : timeZone.vTimeZone != null) return false; + + return true; + } + + public int hashCode() { + int result = vTimeZone != null ? vTimeZone.hashCode() : 0; + result = 31 * result + rawOffset; + return result; + } } diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/TimeZoneRegistryImpl.java --- a/src/net/fortuna/ical4j/model/TimeZoneRegistryImpl.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/TimeZoneRegistryImpl.java Tue Feb 10 19:38:00 2015 +0100 @@ -73,13 +73,19 @@ private static final Properties ALIASES = new Properties(); static { try { - //ALIASES.load(ResourceLoader.getResourceAsStream("net/fortuna/ical4j/model/tz.alias")); - ALIASES.load(TimeZoneRegistryImpl.class.getResourceAsStream("tz.alias")); - } + ALIASES.load(ResourceLoader.getResourceAsStream("net/fortuna/ical4j/model/tz.alias")); + } catch (IOException ioe) { LogFactory.getLog(TimeZoneRegistryImpl.class).warn( "Error loading timezone aliases: " + ioe.getMessage()); } + try { + ALIASES.load(ResourceLoader.getResourceAsStream("tz.alias")); + } + catch (Exception e) { + LogFactory.getLog(TimeZoneRegistryImpl.class).debug( + "Error loading custom timezone aliases: " + e.getMessage()); + } } private Map timezones; @@ -180,8 +186,7 @@ * Loads an existing VTimeZone from the classpath corresponding to the specified Java timezone. */ private VTimeZone loadVTimeZone(final String id) throws IOException, ParserException { - //final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics"); - final URL resource = TimeZoneRegistryImpl.class.getClassLoader().getResource(resourcePrefix + id + ".ics"); + final URL resource = ResourceLoader.getResource(resourcePrefix + id + ".ics"); if (resource != null) { final CalendarBuilder builder = new CalendarBuilder(); final Calendar calendar = builder.build(resource.openStream()); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/WeekDayList.java --- a/src/net/fortuna/ical4j/model/WeekDayList.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/WeekDayList.java Tue Feb 10 19:38:00 2015 +0100 @@ -95,7 +95,7 @@ * where argument is not a net.fortuna.ical4j.model.WeekDay. * @param weekday a week day to add * @return true if the week day is added, otherwise false - * @see List#add(E) + * @see java.util.List#add(Object) */ public final boolean add(final Object weekday) { if (!(weekday instanceof WeekDay)) { diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/component/VEvent.java --- a/src/net/fortuna/ical4j/model/component/VEvent.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/component/VEvent.java Tue Feb 10 19:38:00 2015 +0100 @@ -548,7 +548,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTEND, getProperties()); @@ -643,7 +642,6 @@ PropertyValidator.getInstance().assertOne(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); @@ -747,7 +745,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTEND, getProperties()); @@ -833,7 +830,6 @@ PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); @@ -941,7 +937,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTEND, getProperties()); @@ -1034,7 +1029,6 @@ PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID, getProperties()); PropertyValidator.getInstance().assertNone(Property.ATTACH, getProperties()); @@ -1140,7 +1134,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTEND, getProperties()); @@ -1233,7 +1226,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTEND, getProperties()); @@ -1456,9 +1448,19 @@ public final DtEnd getEndDate(final boolean deriveFromDuration) { DtEnd dtEnd = (DtEnd) getProperty(Property.DTEND); // No DTEND? No problem, we'll use the DURATION. - if (dtEnd == null && deriveFromDuration && getDuration() != null) { + if (dtEnd == null && deriveFromDuration && getStartDate() != null) { final DtStart dtStart = getStartDate(); - final Duration vEventDuration = getDuration(); + final Duration vEventDuration; + if (getDuration() != null) { + vEventDuration = getDuration(); + } else if (dtStart.getDate() instanceof DateTime) { + // If "DTSTART" is a DATE-TIME, then the event's duration is zero (see: RFC 5545, 3.6.1 Event Component) + vEventDuration = new Duration(new Dur(0, 0, 0, 0)); + } else { + // If "DTSTART" is a DATE, then the event's duration is one day (see: RFC 5545, 3.6.1 Event Component) + vEventDuration = new Duration(new Dur(1, 0, 0, 0)); + } + dtEnd = new DtEnd(Dates.getInstance(vEventDuration.getDuration() .getTime(dtStart.getDate()), (Value) dtStart .getParameter(Parameter.VALUE))); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/component/VFreeBusy.java --- a/src/net/fortuna/ical4j/model/component/VFreeBusy.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/component/VFreeBusy.java Tue Feb 10 19:38:00 2015 +0100 @@ -398,7 +398,7 @@ final Period period = (Period) i.next(); // check if period outside bounds.. if (!range.intersects(period)) { - periods.remove(period); + i.remove(); } } return new FreeBusy(periods); @@ -628,7 +628,6 @@ PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.URL, getProperties()); PropertyValidator.getInstance().assertNone(Property.ATTENDEE, getProperties()); @@ -687,7 +686,6 @@ PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.URL, getProperties()); PropertyValidator.getInstance().assertNone(Property.DURATION, getProperties()); @@ -741,8 +739,6 @@ PropertyValidator.getInstance().assertOne(Property.ORGANIZER, getProperties()); PropertyValidator.getInstance().assertOne(Property.UID, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); - PropertyValidator.getInstance().assertNone(Property.FREEBUSY, getProperties()); PropertyValidator.getInstance().assertNone(Property.DURATION, getProperties()); PropertyValidator.getInstance().assertNone(Property.REQUEST_STATUS, getProperties()); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/component/VJournal.java --- a/src/net/fortuna/ical4j/model/component/VJournal.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/component/VJournal.java Tue Feb 10 19:38:00 2015 +0100 @@ -289,7 +289,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.STATUS, getProperties()); @@ -360,7 +359,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -435,7 +433,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.LAST_MODIFIED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.RECURRENCE_ID, getProperties()); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/component/VTimeZone.java --- a/src/net/fortuna/ical4j/model/component/VTimeZone.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/component/VTimeZone.java Tue Feb 10 19:38:00 2015 +0100 @@ -288,7 +288,6 @@ PropertyValidator.getInstance().assertOne(Property.TZOFFSETFROM, observance.getProperties()); PropertyValidator.getInstance().assertOne(Property.TZOFFSETTO, observance.getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, observance.getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.TZNAME, observance.getProperties()); } } diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/component/VToDo.java --- a/src/net/fortuna/ical4j/model/component/VToDo.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/component/VToDo.java Tue Feb 10 19:38:00 2015 +0100 @@ -423,7 +423,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -517,7 +516,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -610,7 +608,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -700,7 +697,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -797,7 +793,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DUE, getProperties()); @@ -886,7 +881,6 @@ PropertyValidator.getInstance().assertNone(Property.ATTACH, getProperties()); PropertyValidator.getInstance().assertNone(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertNone(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertNone(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertNone(Property.CONTACT, getProperties()); PropertyValidator.getInstance().assertNone(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertNone(Property.DESCRIPTION, getProperties()); @@ -981,7 +975,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DTSTART, getProperties()); @@ -1079,7 +1072,6 @@ PropertyValidator.getInstance().assertOneOrLess(Property.SEQUENCE, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CATEGORIES, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CLASS, getProperties()); - PropertyValidator.getInstance().assertOneOrLess(Property.COMMENT, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.CREATED, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DESCRIPTION, getProperties()); PropertyValidator.getInstance().assertOneOrLess(Property.DUE, getProperties()); diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/property/Categories.java --- a/src/net/fortuna/ical4j/model/property/Categories.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/property/Categories.java Tue Feb 10 19:38:00 2015 +0100 @@ -1,176 +1,176 @@ -/** - * Copyright (c) 2012, Ben Fortuna - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * o Neither the name of Ben Fortuna nor the names of any other contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.fortuna.ical4j.model.property; - -import net.fortuna.ical4j.model.TextList; -import net.fortuna.ical4j.model.Parameter; -import net.fortuna.ical4j.model.ParameterList; -import net.fortuna.ical4j.model.Property; -import net.fortuna.ical4j.model.PropertyFactoryImpl; -import net.fortuna.ical4j.model.ValidationException; -import net.fortuna.ical4j.util.ParameterValidator; - -/** - * $Id$ - * - * Created: [Apr 6, 2004] - * - * Defines a CATEGORIES iCalendar component property. - *
- *     4.8.1.2 Categories
- *     
- *        Property Name: CATEGORIES
- *     
- *        Purpose: This property defines the categories for a calendar
- *        component.
- *     
- *        Value Type: TEXT
- *     
- *        Property Parameters: Non-standard and language property parameters
- *        can be specified on this property.
- *     
- *        Conformance: The property can be specified within "VEVENT", "VTODO"
- *        or "VJOURNAL" calendar components.
- *     
- *        Description: This property is used to specify categories or subtypes
- *        of the calendar component. The categories are useful in searching for
- *        a calendar component of a particular type and category. Within the
- *        "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
- *        category can be specified as a list of categories separated by the
- *        COMMA character (US-ASCII decimal 44).
- *     
- *        Format Definition: The property is defined by the following notation:
- *     
- *          categories = "CATEGORIES" catparam ":" text *("," text)
- *                       CRLF
- *     
- *          catparam   = *(
- *     
- *                     ; the following is optional,
- *                     ; but MUST NOT occur more than once
- *     
- *                     (";" languageparam ) /
- *     
- *                     ; the following is optional,
- *                     ; and MAY occur more than once
- *     
- *                     (";" xparam)
- *     
- *                     )
- * 
- * @author benf - */ -public class Categories extends Property { - - private static final long serialVersionUID = -7769987073466681634L; - - private TextList categories; - - /** - * Default constructor. - */ - public Categories() { - super(CATEGORIES, PropertyFactoryImpl.getInstance()); - categories = new TextList(); - } - - /** - * @param aValue a value string for this component - */ - public Categories(final String aValue) { - super(CATEGORIES, PropertyFactoryImpl.getInstance()); - setValue(aValue); - } - - /** - * @param aList a list of parameters for this component - * @param aValue a value string for this component - */ - public Categories(final ParameterList aList, final String aValue) { - super(CATEGORIES, aList, PropertyFactoryImpl.getInstance()); - setValue(aValue); - } - - /** - * @param cList a list of categories - */ - public Categories(final TextList cList) { - super(CATEGORIES, PropertyFactoryImpl.getInstance()); - categories = cList; - } - - /** - * @param aList a list of parameters for this component - * @param cList a list of categories - */ - public Categories(final ParameterList aList, final TextList cList) { - super(CATEGORIES, aList, PropertyFactoryImpl.getInstance()); - categories = cList; - } - - /** - * {@inheritDoc} - */ - public final void setValue(final String aValue) { - categories = new TextList(aValue); - } - - /** - * {@inheritDoc} - */ - public final void validate() throws ValidationException { - - /* - * ; the following is optional, ; but MUST NOT occur more than once (";" languageparam ) / - */ - ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE, - getParameters()); - - /* - * ; the following is optional, ; and MAY occur more than once (";" xparam) - */ - } - - /** - * @return Returns the categories. - */ - public final TextList getCategories() { - return categories; - } - - /** - * {@inheritDoc} - */ - public final String getValue() { - return getCategories().toString(); - } -} +/** + * Copyright (c) 2012, Ben Fortuna + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * o Neither the name of Ben Fortuna nor the names of any other contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.fortuna.ical4j.model.property; + +import net.fortuna.ical4j.model.TextList; +import net.fortuna.ical4j.model.Parameter; +import net.fortuna.ical4j.model.ParameterList; +import net.fortuna.ical4j.model.Property; +import net.fortuna.ical4j.model.PropertyFactoryImpl; +import net.fortuna.ical4j.model.ValidationException; +import net.fortuna.ical4j.util.ParameterValidator; + +/** + * $Id$ + * + * Created: [Apr 6, 2004] + * + * Defines a CATEGORIES iCalendar component property. + *
+ *     4.8.1.2 Categories
+ *     
+ *        Property Name: CATEGORIES
+ *     
+ *        Purpose: This property defines the categories for a calendar
+ *        component.
+ *     
+ *        Value Type: TEXT
+ *     
+ *        Property Parameters: Non-standard and language property parameters
+ *        can be specified on this property.
+ *     
+ *        Conformance: The property can be specified within "VEVENT", "VTODO"
+ *        or "VJOURNAL" calendar components.
+ *     
+ *        Description: This property is used to specify categories or subtypes
+ *        of the calendar component. The categories are useful in searching for
+ *        a calendar component of a particular type and category. Within the
+ *        "VEVENT", "VTODO" or "VJOURNAL" calendar components, more than one
+ *        category can be specified as a list of categories separated by the
+ *        COMMA character (US-ASCII decimal 44).
+ *     
+ *        Format Definition: The property is defined by the following notation:
+ *     
+ *          categories = "CATEGORIES" catparam ":" text *("," text)
+ *                       CRLF
+ *     
+ *          catparam   = *(
+ *     
+ *                     ; the following is optional,
+ *                     ; but MUST NOT occur more than once
+ *     
+ *                     (";" languageparam ) /
+ *     
+ *                     ; the following is optional,
+ *                     ; and MAY occur more than once
+ *     
+ *                     (";" xparam)
+ *     
+ *                     )
+ * 
+ * @author benf + */ +public class Categories extends Property { + + private static final long serialVersionUID = -7769987073466681634L; + + private TextList categories; + + /** + * Default constructor. + */ + public Categories() { + super(CATEGORIES, PropertyFactoryImpl.getInstance()); + categories = new TextList(); + } + + /** + * @param aValue a value string for this component + */ + public Categories(final String aValue) { + super(CATEGORIES, PropertyFactoryImpl.getInstance()); + setValue(aValue); + } + + /** + * @param aList a list of parameters for this component + * @param aValue a value string for this component + */ + public Categories(final ParameterList aList, final String aValue) { + super(CATEGORIES, aList, PropertyFactoryImpl.getInstance()); + setValue(aValue); + } + + /** + * @param cList a list of categories + */ + public Categories(final TextList cList) { + super(CATEGORIES, PropertyFactoryImpl.getInstance()); + categories = cList; + } + + /** + * @param aList a list of parameters for this component + * @param cList a list of categories + */ + public Categories(final ParameterList aList, final TextList cList) { + super(CATEGORIES, aList, PropertyFactoryImpl.getInstance()); + categories = cList; + } + + /** + * {@inheritDoc} + */ + public final void setValue(final String aValue) { + categories = new TextList(aValue); + } + + /** + * {@inheritDoc} + */ + public final void validate() throws ValidationException { + + /* + * ; the following is optional, ; but MUST NOT occur more than once (";" languageparam ) / + */ + ParameterValidator.getInstance().assertOneOrLess(Parameter.LANGUAGE, + getParameters()); + + /* + * ; the following is optional, ; and MAY occur more than once (";" xparam) + */ + } + + /** + * @return Returns the categories. + */ + public final TextList getCategories() { + return categories; + } + + /** + * {@inheritDoc} + */ + public final String getValue() { + return getCategories().toString(); + } +} diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/property/RRule.java --- a/src/net/fortuna/ical4j/model/property/RRule.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/property/RRule.java Tue Feb 10 19:38:00 2015 +0100 @@ -1,129 +1,129 @@ -/** - * Copyright (c) 2012, Ben Fortuna - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * o Neither the name of Ben Fortuna nor the names of any other contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.fortuna.ical4j.model.property; - -import java.text.ParseException; - -import net.fortuna.ical4j.model.ParameterList; -import net.fortuna.ical4j.model.Property; -import net.fortuna.ical4j.model.PropertyFactoryImpl; -import net.fortuna.ical4j.model.Recur; -import net.fortuna.ical4j.model.ValidationException; - -/** - * $Id$ - * - * Created: [Apr 6, 2004] - * - * Defines an RRULE iCalendar component property. - * @author benf - */ -public class RRule extends Property { - - private static final long serialVersionUID = -9188265089143001164L; - - private Recur recur; - - /** - * Default constructor. - */ - public RRule() { - super(RRULE, PropertyFactoryImpl.getInstance()); - recur = new Recur(Recur.DAILY, 1); - } - - /** - * @param value a rule string - * @throws ParseException where the specified string is not a valid rule - */ - public RRule(String value) throws ParseException { - super(RRULE, PropertyFactoryImpl.getInstance()); - setValue(value); - } - - /** - * @param aList a list of parameters for this component - * @param aValue a value string for this component - * @throws ParseException thrown when the specified string is not a valid representaton of a recurrence - * @see Recur#Recur(String) - */ - public RRule(final ParameterList aList, final String aValue) - throws ParseException { - super(RRULE, aList, PropertyFactoryImpl.getInstance()); - setValue(aValue); - } - - /** - * @param aRecur a recurrence value - */ - public RRule(final Recur aRecur) { - super(RRULE, PropertyFactoryImpl.getInstance()); - recur = aRecur; - } - - /** - * @param aList a list of parameters for this component - * @param aRecur a recurrence value - */ - public RRule(final ParameterList aList, final Recur aRecur) { - super(RRULE, aList, PropertyFactoryImpl.getInstance()); - recur = aRecur; - } - - /** - * @return Returns the recur. - */ - public final Recur getRecur() { - return recur; - } - - /** - * {@inheritDoc} - */ - public final void setValue(final String aValue) throws ParseException { - recur = new Recur(aValue); - } - - /** - * {@inheritDoc} - */ - public final String getValue() { - return getRecur().toString(); - } - - /** - * {@inheritDoc} - */ - public final void validate() throws ValidationException { - // TODO: Auto-generated method stub - } -} +/** + * Copyright (c) 2012, Ben Fortuna + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * o Neither the name of Ben Fortuna nor the names of any other contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.fortuna.ical4j.model.property; + +import java.text.ParseException; + +import net.fortuna.ical4j.model.ParameterList; +import net.fortuna.ical4j.model.Property; +import net.fortuna.ical4j.model.PropertyFactoryImpl; +import net.fortuna.ical4j.model.Recur; +import net.fortuna.ical4j.model.ValidationException; + +/** + * $Id$ + * + * Created: [Apr 6, 2004] + * + * Defines an RRULE iCalendar component property. + * @author benf + */ +public class RRule extends Property { + + private static final long serialVersionUID = -9188265089143001164L; + + private Recur recur; + + /** + * Default constructor. + */ + public RRule() { + super(RRULE, PropertyFactoryImpl.getInstance()); + recur = new Recur(Recur.DAILY, 1); + } + + /** + * @param value a rule string + * @throws ParseException where the specified string is not a valid rule + */ + public RRule(String value) throws ParseException { + super(RRULE, PropertyFactoryImpl.getInstance()); + setValue(value); + } + + /** + * @param aList a list of parameters for this component + * @param aValue a value string for this component + * @throws ParseException thrown when the specified string is not a valid representaton of a recurrence + * @see Recur#Recur(String) + */ + public RRule(final ParameterList aList, final String aValue) + throws ParseException { + super(RRULE, aList, PropertyFactoryImpl.getInstance()); + setValue(aValue); + } + + /** + * @param aRecur a recurrence value + */ + public RRule(final Recur aRecur) { + super(RRULE, PropertyFactoryImpl.getInstance()); + recur = aRecur; + } + + /** + * @param aList a list of parameters for this component + * @param aRecur a recurrence value + */ + public RRule(final ParameterList aList, final Recur aRecur) { + super(RRULE, aList, PropertyFactoryImpl.getInstance()); + recur = aRecur; + } + + /** + * @return Returns the recur. + */ + public final Recur getRecur() { + return recur; + } + + /** + * {@inheritDoc} + */ + public final void setValue(final String aValue) throws ParseException { + recur = new Recur(aValue); + } + + /** + * {@inheritDoc} + */ + public final String getValue() { + return getRecur().toString(); + } + + /** + * {@inheritDoc} + */ + public final void validate() throws ValidationException { + // TODO: Auto-generated method stub + } +} diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/property/TzOffsetTo.java --- a/src/net/fortuna/ical4j/model/property/TzOffsetTo.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/model/property/TzOffsetTo.java Tue Feb 10 19:38:00 2015 +0100 @@ -1,132 +1,132 @@ -/** - * Copyright (c) 2012, Ben Fortuna - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * o Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * o Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * o Neither the name of Ben Fortuna nor the names of any other contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.fortuna.ical4j.model.property; - -import net.fortuna.ical4j.model.ParameterList; -import net.fortuna.ical4j.model.Property; -import net.fortuna.ical4j.model.PropertyFactoryImpl; -import net.fortuna.ical4j.model.UtcOffset; -import net.fortuna.ical4j.model.ValidationException; - -/** - * $Id$ - * - * Created: [Apr 6, 2004] - * - * Defines a TZOFFSETTO iCalendar component property. - * @author benf - */ -public class TzOffsetTo extends Property { - - private static final long serialVersionUID = 8213874575051177732L; - - private UtcOffset offset; - - /** - * Default constructor. - */ - public TzOffsetTo() { - super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); - } - - /** - * @param value an offset value - */ - public TzOffsetTo(String value) { - super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); - setValue(value); - } - - /** - * @param aList a list of parameters for this component - * @param aValue a value string for this component - */ - public TzOffsetTo(final ParameterList aList, final String aValue) { - super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); - setValue(aValue); - } - - /** - * @param anOffset a timezone offset in milliseconds - */ - public TzOffsetTo(final UtcOffset anOffset) { - super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); - offset = anOffset; - } - - /** - * @param aList a list of parameters for this component - * @param anOffset a timezone offset in milliseconds - */ - public TzOffsetTo(final ParameterList aList, final UtcOffset anOffset) { - super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); - offset = anOffset; - } - - /** - * @return Returns the offset. - */ - public final UtcOffset getOffset() { - return offset; - } - - /** - * {@inheritDoc} - */ - public final void setValue(final String aValue) { - offset = new UtcOffset(aValue); - } - - /** - * {@inheritDoc} - */ - public final String getValue() { - if (offset != null) { - return offset.toString(); - } - return ""; - } - - /** - * @param offset The offset to set. - */ - public final void setOffset(final UtcOffset offset) { - this.offset = offset; - } - - /** - * {@inheritDoc} - */ - public final void validate() throws ValidationException { - // TODO: Auto-generated method stub - } -} +/** + * Copyright (c) 2012, Ben Fortuna + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * o Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * o Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * o Neither the name of Ben Fortuna nor the names of any other contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.fortuna.ical4j.model.property; + +import net.fortuna.ical4j.model.ParameterList; +import net.fortuna.ical4j.model.Property; +import net.fortuna.ical4j.model.PropertyFactoryImpl; +import net.fortuna.ical4j.model.UtcOffset; +import net.fortuna.ical4j.model.ValidationException; + +/** + * $Id$ + * + * Created: [Apr 6, 2004] + * + * Defines a TZOFFSETTO iCalendar component property. + * @author benf + */ +public class TzOffsetTo extends Property { + + private static final long serialVersionUID = 8213874575051177732L; + + private UtcOffset offset; + + /** + * Default constructor. + */ + public TzOffsetTo() { + super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); + } + + /** + * @param value an offset value + */ + public TzOffsetTo(String value) { + super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); + setValue(value); + } + + /** + * @param aList a list of parameters for this component + * @param aValue a value string for this component + */ + public TzOffsetTo(final ParameterList aList, final String aValue) { + super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); + setValue(aValue); + } + + /** + * @param anOffset a timezone offset in milliseconds + */ + public TzOffsetTo(final UtcOffset anOffset) { + super(TZOFFSETTO, PropertyFactoryImpl.getInstance()); + offset = anOffset; + } + + /** + * @param aList a list of parameters for this component + * @param anOffset a timezone offset in milliseconds + */ + public TzOffsetTo(final ParameterList aList, final UtcOffset anOffset) { + super(TZOFFSETTO, aList, PropertyFactoryImpl.getInstance()); + offset = anOffset; + } + + /** + * @return Returns the offset. + */ + public final UtcOffset getOffset() { + return offset; + } + + /** + * {@inheritDoc} + */ + public final void setValue(final String aValue) { + offset = new UtcOffset(aValue); + } + + /** + * {@inheritDoc} + */ + public final String getValue() { + if (offset != null) { + return offset.toString(); + } + return ""; + } + + /** + * @param offset The offset to set. + */ + public final void setOffset(final UtcOffset offset) { + this.offset = offset; + } + + /** + * {@inheritDoc} + */ + public final void validate() throws ValidationException { + // TODO: Auto-generated method stub + } +} diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/model/tz.alias --- a/src/net/fortuna/ical4j/model/tz.alias Tue Feb 10 19:25:00 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -## Unsupported timezone identifiers.. -Etc/GMT+0=Etc/GMT -Etc/GMT-0=Etc/GMT -Etc/GMT0=Etc/GMT -GMT=Etc/GMT - -### Temporary hack to support above timezones.. -Etc/GMT=Europe/London -Etc/Greenwich=Etc/GMT -Etc/UCT=Europe/London -Etc/UTC=Europe/London -Etc/Universal=Etc/UTC - -Etc/Zulu=Etc/UTC - -## Non-Oslon aliases: -# -US/Pacific-New=America/Los_Angeles - -## Update Olson backward compatibility here: -# -Africa/Asmera = Africa/Asmara -Africa/Timbuktu = Africa/Bamako -America/Argentina/ComodRivadavia = America/Argentina/Catamarca -America/Atka = America/Adak -America/Buenos_Aires = America/Argentina/Buenos_Aires -America/Catamarca = America/Argentina/Catamarca -America/Coral_Harbour = America/Atikokan -America/Cordoba = America/Argentina/Cordoba -America/Ensenada = America/Tijuana -America/Fort_Wayne = America/Indiana/Indianapolis -America/Indianapolis = America/Indiana/Indianapolis -America/Jujuy = America/Argentina/Jujuy -America/Knox_IN = America/Indiana/Knox -America/Louisville = America/Kentucky/Louisville -America/Mendoza = America/Argentina/Mendoza -America/Porto_Acre = America/Rio_Branco -America/Rosario = America/Argentina/Cordoba -America/Virgin = America/St_Thomas -Asia/Ashkhabad = Asia/Ashgabat -Asia/Chungking = Asia/Chongqing -Asia/Dacca = Asia/Dhaka -Asia/Katmandu = Asia/Kathmandu -Asia/Calcutta = Asia/Kolkata -Asia/Macao = Asia/Macau -Asia/Tel_Aviv = Asia/Jerusalem -Asia/Saigon = Asia/Ho_Chi_Minh -Asia/Thimbu = Asia/Thimphu -Asia/Ujung_Pandang = Asia/Makassar -Asia/Ulan_Bator = Asia/Ulaanbaatar -Atlantic/Faeroe = Atlantic/Faroe -Atlantic/Jan_Mayen = Europe/Oslo -Australia/ACT = Australia/Sydney -Australia/Canberra = Australia/Sydney -Australia/LHI = Australia/Lord_Howe -Australia/NSW = Australia/Sydney -Australia/North = Australia/Darwin -Australia/Queensland = Australia/Brisbane -Australia/South = Australia/Adelaide -Australia/Tasmania = Australia/Hobart -Australia/Victoria = Australia/Melbourne -Australia/West = Australia/Perth -Australia/Yancowinna = Australia/Broken_Hill -Brazil/Acre = America/Rio_Branco -Brazil/DeNoronha = America/Noronha -Brazil/East = America/Sao_Paulo -Brazil/West = America/Manaus -Canada/Atlantic = America/Halifax -Canada/Central = America/Winnipeg -Canada/East-Saskatchewan = America/Regina -Canada/Eastern = America/Toronto -Canada/Mountain = America/Edmonton -Canada/Newfoundland = America/St_Johns -Canada/Pacific = America/Vancouver -Canada/Saskatchewan = America/Regina -Canada/Yukon = America/Whitehorse -Chile/Continental = America/Santiago -Chile/EasterIsland = Pacific/Easter -Cuba = America/Havana -Egypt = Africa/Cairo -Eire = Europe/Dublin -Europe/Belfast = Europe/London -Europe/Tiraspol = Europe/Chisinau -GB = Europe/London -GB-Eire = Europe/London -GMT+0 = Etc/GMT -GMT-0 = Etc/GMT -GMT0 = Etc/GMT -Greenwich = Etc/GMT -Hongkong = Asia/Hong_Kong -Iceland = Atlantic/Reykjavik -Iran = Asia/Tehran -Israel = Asia/Jerusalem -Jamaica = America/Jamaica -Japan = Asia/Tokyo -Kwajalein = Pacific/Kwajalein -Libya = Africa/Tripoli -Mexico/BajaNorte = America/Tijuana -Mexico/BajaSur = America/Mazatlan -Mexico/General = America/Mexico_City -NZ = Pacific/Auckland -NZ-CHAT = Pacific/Chatham -Navajo = America/Denver -PRC = Asia/Shanghai -Pacific/Samoa = Pacific/Pago_Pago -Pacific/Yap = Pacific/Chuuk -Pacific/Truk = Pacific/Chuuk -Pacific/Ponape = Pacific/Pohnpei -Poland = Europe/Warsaw -Portugal = Europe/Lisbon -ROC = Asia/Taipei -ROK = Asia/Seoul -Singapore = Asia/Singapore -Turkey = Europe/Istanbul -UCT = Etc/UCT -US/Alaska = America/Anchorage -US/Aleutian = America/Adak -US/Arizona = America/Phoenix -US/Central = America/Chicago -US/East-Indiana = America/Indiana/Indianapolis -US/Eastern = America/New_York -US/Hawaii = Pacific/Honolulu -US/Indiana-Starke = America/Indiana/Knox -US/Michigan = America/Detroit -US/Mountain = America/Denver -US/Pacific = America/Los_Angeles -US/Samoa = Pacific/Pago_Pago -UTC = Etc/UTC -Universal = Etc/UTC -W-SU = Europe/Moscow -Zulu = Etc/UTC diff -r dee028db6e9b -r 73bdfa70b04e src/net/fortuna/ical4j/util/CompatibilityHints.java --- a/src/net/fortuna/ical4j/util/CompatibilityHints.java Tue Feb 10 19:25:00 2015 +0100 +++ b/src/net/fortuna/ical4j/util/CompatibilityHints.java Tue Feb 10 19:38:00 2015 +0100 @@ -76,6 +76,11 @@ * compatibility is enabled by setting this system property to "true". */ public static final String KEY_NOTES_COMPATIBILITY = "ical4j.compatibility.notes"; + + /** + * Support for vCard features that are not necessarily compatible with the iCalendar standard. + */ + public static final String KEY_VCARD_COMPATIBILITY = "ical4j.compatibility.vcard"; private static final Map HINTS = new ConcurrentHashMap(); // preload known hints from the configurator