diff options
author | Andy McFadden <fadden@android.com> | 2011-07-19 14:41:30 -0700 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2011-07-19 14:41:30 -0700 |
commit | 6d5684cdf6886a46ee993c8ec986d306472cd5b0 (patch) | |
tree | 60d5f5bec5e6f200613a0505419d8defb4f6fa11 | |
parent | e29edf9b71fbec8a7c7f0b523ca105a377632989 (diff) | |
download | calendar-6d5684cdf6886a46ee993c8ec986d306472cd5b0.tar.gz |
Don't require FREQ to come first
The definition of "recur" in 4.3.10 suggests that FREQ must
come first, but the description is really just trying to say that
FREQ is mandatory. The text makes it clear that there is no
ordering on rule parts.
This removes the explicit test, and updates the set of test
rules.
Change-Id: I908ae388456a7df2d12a0c18a2174af8f95ec421
-rw-r--r-- | src/com/android/calendarcommon/EventRecurrence.java | 5 | ||||
-rw-r--r-- | tests/src/com/android/calendarcommon/EventRecurrenceTest.java | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/com/android/calendarcommon/EventRecurrence.java b/src/com/android/calendarcommon/EventRecurrence.java index fa5d47c..57a8c20 100644 --- a/src/com/android/calendarcommon/EventRecurrence.java +++ b/src/com/android/calendarcommon/EventRecurrence.java @@ -551,6 +551,8 @@ public class EventRecurrence { * ( ";" x-name "=" text ) * ) * + * The rule parts are not ordered in any particular sequence. + * * Examples: * FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU * FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8 @@ -620,9 +622,6 @@ public class EventRecurrence { if ((parseFlags & flag) != 0) { throw new InvalidFormatException("Part " + lhs + " was specified twice"); } - if (parseFlags == 0 && flag != PARSED_FREQ) { - throw new InvalidFormatException("FREQ must be specified first"); - } parseFlags |= flag; } } diff --git a/tests/src/com/android/calendarcommon/EventRecurrenceTest.java b/tests/src/com/android/calendarcommon/EventRecurrenceTest.java index 1bddc61..35777eb 100644 --- a/tests/src/com/android/calendarcommon/EventRecurrenceTest.java +++ b/tests/src/com/android/calendarcommon/EventRecurrenceTest.java @@ -711,19 +711,20 @@ public class EventRecurrenceTest extends TestCase { "FREQ=SECONDLY;BYSECOND=0,15,59", "FREQ=MINUTELY;BYMINUTE=0,15,59", "FREQ=HOURLY;BYHOUR=+0,+15,+23", - "FREQ=DAILY;X-WHATEVER=blah", // fails on old parser - //"freq=daily;wkst=su", // fails on old parser + "INTERVAL=4;FREQ=YEARLY", + "FREQ=DAILY;X-WHATEVER=blah", + //"freq=daily;wkst=su", // mixed case currently not allowed }; /** The parser must reject these. */ private static final String[] BAD_RRULES = { - "INTERVAL=4;FREQ=YEARLY", // FREQ must come first "FREQ=MONTHLY;FREQ=MONTHLY", // can't specify twice "FREQ=MONTHLY;COUNT=1;COUNT=1", // can't specify twice "FREQ=SECONDLY;BYSECOND=60", // range "FREQ=MINUTELY;BYMINUTE=-1", // range "FREQ=HOURLY;BYHOUR=24", // range "FREQ=YEARLY;BYMONTHDAY=0", // zero not valid + "BYMONTHDAY=1", // must specify FREQ //"FREQ=YEARLY;COUNT=1;UNTIL=12345", // can't have both COUNT and UNTIL //"FREQ=DAILY;UNTIL=19970829T021400e", // invalid date }; |