1.1 --- a/src/net/fortuna/ical4j/model/DateTime.java Tue Feb 10 19:25:00 2015 +0100 1.2 +++ b/src/net/fortuna/ical4j/model/DateTime.java Tue Feb 10 19:38:00 2015 +0100 1.3 @@ -42,7 +42,6 @@ 1.4 import net.fortuna.ical4j.util.TimeZones; 1.5 1.6 import org.apache.commons.lang.builder.EqualsBuilder; 1.7 -import org.apache.commons.lang.builder.HashCodeBuilder; 1.8 1.9 /** 1.10 * $Id$ 1.11 @@ -161,6 +160,8 @@ 1.12 private static final String DEFAULT_PATTERN = "yyyyMMdd'T'HHmmss"; 1.13 1.14 private static final String UTC_PATTERN = "yyyyMMdd'T'HHmmss'Z'"; 1.15 + 1.16 + private static final String VCARD_PATTERN = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"; 1.17 1.18 private static final String RELAXED_PATTERN = "yyyyMMdd"; 1.19 1.20 @@ -195,10 +196,16 @@ 1.21 private static final DateFormatCache RELAXED_FORMAT; 1.22 static { 1.23 final DateFormat format = new SimpleDateFormat(RELAXED_PATTERN); 1.24 - format.setLenient(false); 1.25 + format.setLenient(true); 1.26 RELAXED_FORMAT = new DateFormatCache(format); 1.27 } 1.28 1.29 + private static final DateFormatCache VCARD_FORMAT; 1.30 + static { 1.31 + final DateFormat format = new SimpleDateFormat(VCARD_PATTERN); 1.32 + VCARD_FORMAT = new DateFormatCache(format); 1.33 + } 1.34 + 1.35 private Time time; 1.36 1.37 private TimeZone timezone; 1.38 @@ -305,8 +312,18 @@ 1.39 setTimeZone(timezone); 1.40 } 1.41 } catch (ParseException pe) { 1.42 - if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { 1.43 + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_VCARD_COMPATIBILITY)) { 1.44 1.45 + try { 1.46 + setTime(value, (DateFormat) VCARD_FORMAT.get(), timezone); 1.47 + setTimeZone(timezone); 1.48 + } catch (ParseException pe2) { 1.49 + if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { 1.50 + setTime(value, (DateFormat) RELAXED_FORMAT.get(), timezone); 1.51 + setTimeZone(timezone); 1.52 + } 1.53 + } 1.54 + } else if (CompatibilityHints.isHintEnabled(CompatibilityHints.KEY_RELAXED_PARSING)) { 1.55 setTime(value, (DateFormat) RELAXED_FORMAT.get(), timezone); 1.56 setTimeZone(timezone); 1.57 } else {