aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.mk4
-rw-r--r--src/com/android/calendarcommon2/RecurrenceProcessor.java4
-rw-r--r--tests/src/com/android/calendarcommon2/RRuleTest.java14
3 files changed, 16 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk
index ffa7606..2ba308e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -16,8 +16,10 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := calendar-common
-LOCAL_SDK_VERSION := current
+
+LOCAL_SDK_VERSION := 15
LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
include $(BUILD_STATIC_JAVA_LIBRARY)
# Build the test package
diff --git a/src/com/android/calendarcommon2/RecurrenceProcessor.java b/src/com/android/calendarcommon2/RecurrenceProcessor.java
index 641a161..fd225db 100644
--- a/src/com/android/calendarcommon2/RecurrenceProcessor.java
+++ b/src/com/android/calendarcommon2/RecurrenceProcessor.java
@@ -869,7 +869,9 @@ bysetpos:
while (true) {
int monthIndex = 0;
if (failsafe++ > MAX_ALLOWED_ITERATIONS) { // Give up after about 1 second of processing
- throw new DateException("Recurrence processing stuck: " + r.toString());
+ Log.w(TAG, "Recurrence processing stuck with r=" + r + " rangeStart="
+ + rangeStartDateValue + " rangeEnd=" + rangeEndDateValue);
+ break;
}
unsafeNormalize(iterator);
diff --git a/tests/src/com/android/calendarcommon2/RRuleTest.java b/tests/src/com/android/calendarcommon2/RRuleTest.java
index 53988e2..1d72366 100644
--- a/tests/src/com/android/calendarcommon2/RRuleTest.java
+++ b/tests/src/com/android/calendarcommon2/RRuleTest.java
@@ -143,11 +143,17 @@ public class RRuleTest extends TestCase {
// Infinite loop, bug 1662110
@MediumTest
public void testFrequencyLimits() throws Exception {
- try {
- runRecurrenceIteratorTest("RRULE:FREQ=SECONDLY;BYSECOND=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14," + "15,16,17,18,19,20,21,22,23,24,25,26,27,28,29," + "30,31,32,33,34,35,36,37,38,39,40,41,42,43,44," + "45,46,47,48,49,50,51,52,53,54,55,56,57,58,59", "20000101", 1, "");
+ // Rather than checking that we get an exception,
+ // we now want to finish, but in a reasonable time
+ final long tenSeconds = 10000;
+ long start = System.currentTimeMillis();
+ runRecurrenceIteratorTest(
+ "RRULE:FREQ=SECONDLY;BYSECOND=0,1,2,3,4,5,6,7,8,9,10,11,12,13,14," +
+ "15,16,17,18,19,20,21,22,23,24,25,26,27,28,29," +
+ "30,31,32,33,34,35,36,37,38,39,40,41,42,43,44," +
+ "45,46,47,48,49,50,51,52,53,54,55,56,57,58,59", "20000101", 1, "20000101");
+ if (System.currentTimeMillis() - start > tenSeconds) {
fail("Don't do that");
- } catch (DateException ex) {
- // pass
}
}