aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlice Yang <alice@google.com>2012-05-15 17:26:26 -0700
committerAlice Yang <alice@google.com>2012-05-15 17:26:26 -0700
commita991358d94947cc0dbd6a8d75dd77b5fd377734b (patch)
treefab60242264e667240b20dbcca32b3e5ffda54b9
parent1546ea7c0d8791a690af9326904f1472321c95df (diff)
downloadcalendar-a991358d94947cc0dbd6a8d75dd77b5fd377734b.tar.gz
Allow ";;"
Allow for consecutive ";" in rules for recurring events. Bug 6312732 Change-Id: I3bd82b7818cd755eec7129ca6497746a91cb6653
-rw-r--r--src/com/android/calendarcommon/EventRecurrence.java4
-rw-r--r--tests/src/com/android/calendarcommon/EventRecurrenceTest.java5
2 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/calendarcommon/EventRecurrence.java b/src/com/android/calendarcommon/EventRecurrence.java
index cf2b410..ac03e45 100644
--- a/src/com/android/calendarcommon/EventRecurrence.java
+++ b/src/com/android/calendarcommon/EventRecurrence.java
@@ -598,6 +598,10 @@ public class EventRecurrence {
parts = recur.split(";");
}
for (String part : parts) {
+ // allow empty part (e.g., double semicolon ";;")
+ if (TextUtils.isEmpty(part)) {
+ continue;
+ }
int equalIndex = part.indexOf('=');
if (equalIndex <= 0) {
/* no '=' or no LHS */
diff --git a/tests/src/com/android/calendarcommon/EventRecurrenceTest.java b/tests/src/com/android/calendarcommon/EventRecurrenceTest.java
index a058adf..efd5f1c 100644
--- a/tests/src/com/android/calendarcommon/EventRecurrenceTest.java
+++ b/tests/src/com/android/calendarcommon/EventRecurrenceTest.java
@@ -843,6 +843,11 @@ public class EventRecurrenceTest extends TestCase {
"INTERVAL=4;FREQ=YEARLY",
"FREQ=DAILY;X-WHATEVER=blah",
//"freq=daily;wkst=su", // mixed case currently not allowed
+ "FREQ=WEEKLY;INTERVAL=2;BYDAY=Mo;;UNTIL=20120327T000000Z", // double simicolon should be allowed
+ "FREQ=MONTHLY;BYDAY=1Mo",
+ "FREQ=MONTHLY;BYDAY=2Mo,2We,4Mo,4We",
+ "FREQ=MONTHLY;WKST=SU;BYMONTHDAY=25;UNTIL=20110524",
+ "FREQ=WEEKLY;BYDAY=MO;WKST=SU;UNTIL=20111218T010000Z"
};
/** The parser must reject these. */