Automated import from //branches/donutburger/...@141761,141761
diff --git a/src/com/android/providers/calendar/CalendarSyncAdapter.java b/src/com/android/providers/calendar/CalendarSyncAdapter.java
index e9137fe..c84a4ff 100644
--- a/src/com/android/providers/calendar/CalendarSyncAdapter.java
+++ b/src/com/android/providers/calendar/CalendarSyncAdapter.java
@@ -546,6 +546,10 @@
* Clear out the map and stuff an Entry into it in a format that can
* be inserted into a content provider.
*
+ * If a date is before 1970 or past 2038, ENTRY_INVALID is returned, and DTSTART
+ * is set to -1. This is due to the current 32-bit time restriction and
+ * will be fixed in a future release.
+ *
* @return ENTRY_OK, ENTRY_DELETED, or ENTRY_INVALID
*/
private int entryToContentValues(EventEntry event, Long syncLocalId,
@@ -741,7 +745,15 @@
map.put(Events.EVENT_TIMEZONE, syncInfo.calendarTimezone);
}
- map.put(Events.DTSTART, time.toMillis(false /* use isDst */));
+ long dtstart = time.toMillis(false /* use isDst */);
+ if (dtstart < 0) {
+ if (Config.LOGD) {
+ Log.d(TAG, "dtstart out of range: " + startTime);
+ }
+ map.put(Events.DTSTART, -1); // Flag to caller that date is out of range
+ return ENTRY_INVALID;
+ }
+ map.put(Events.DTSTART, dtstart);
timesSet = true;
}
@@ -749,7 +761,15 @@
String endTime = when.getEndTime();
if (!StringUtils.isEmpty(endTime)) {
time.parse3339(endTime);
- map.put(Events.DTEND, time.toMillis(false /* use isDst */));
+ long dtend = time.toMillis(false /* use isDst */);
+ if (dtend < 0) {
+ if (Config.LOGD) {
+ Log.d(TAG, "dtend out of range: " + endTime);
+ }
+ map.put(Events.DTSTART, -1); // Flag to caller that date is out of range
+ return ENTRY_INVALID;
+ }
+ map.put(Events.DTEND, dtend);
}
}