Fix bug 482108 - "Invalid alarm for item" errors when reading alarms from older releases (regression). r=dbo
authorPhilipp Kewisch <mozilla@kewis.ch>
Sat, 28 Mar 2009 14:30:23 +0100
changeset 2299 054adad6539de39cabfcdf5664293f210823b447
parent 2298 5b7638646d00da628bf654030fa8fdd87993fa40
child 2300 fcb7cbdcfe88f0b810e2224a7adbf193aea20d30
push id1861
push usermozilla@kewis.ch
push dateSat, 28 Mar 2009 13:30:32 +0000
treeherdercomm-central@054adad6539d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbo
bugs482108
Fix bug 482108 - "Invalid alarm for item" errors when reading alarms from older releases (regression). r=dbo
calendar/base/src/calAlarm.js
calendar/base/src/calItemBase.js
--- a/calendar/base/src/calAlarm.js
+++ b/calendar/base/src/calAlarm.js
@@ -526,18 +526,20 @@ calAlarm.prototype = {
         }
 
         // Set up summary
         this.summary = (summaryProp ? summaryProp.value : null);
 
         // Set up description
         this.description = (descriptionProp ? descriptionProp.value : null);
 
-        // Set up the alarm lastack
-        this.lastAck = (lastAckProp ? lastAckProp.valueAsDatetime : null);
+        // Set up the alarm lastack. We can't use valueAsDatetime here since
+        // the default for an X-Prop is TEXT and in older versions we didn't set
+        // VALUE=DATE-TIME.
+        this.lastAck = (lastAckProp ? cal.createDateTime(lastAckProp.valueAsIcalString) : null);
 
         this.mProperties = new calPropertyBag();
         this.mPropertyParams = {};
 
         // Other properties
         for (let prop in cal.ical.propertyIterator(aComp)) {
             if (!this.promotedProps[prop.propertyName]) {
                 this.setProperty(prop.propertyName, prop.value);
--- a/calendar/base/src/calItemBase.js
+++ b/calendar/base/src/calItemBase.js
@@ -799,17 +799,18 @@ calItemBase.prototype = {
         for (let alarmComp in cal.ical.subcomponentIterator(icalcomp, "VALARM")) {
             let alarm = cal.createAlarm();
             try {
                 alarm.icalComponent = alarmComp;
                 this.addAlarm(alarm, true);
             } catch (e) {
                 cal.ERROR("Invalid alarm for item: " +
                           this.id + " (" +
-                          alarmComp.serializeToICS() + ")");
+                          alarmComp.serializeToICS() + ")" +
+                          " exception: " + e);
             }
         }
 
         let lastAck = icalcomp.getFirstProperty("X-MOZ-LASTACK");
         this.mAlarmLastAck = null;
         if (lastAck) {
             this.mAlarmLastAck = cal.createDateTime(lastAck.value);
         }