catch exceptions from the registry connector
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 28 Apr 2010 16:49:08 +0000 (12:49 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 28 Apr 2010 16:49:54 +0000 (12:49 -0400)
framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php
framework/ActiveSync/lib/Horde/ActiveSync/Request/GetItemEstimate.php

index 0b4b440..2672402 100644 (file)
@@ -49,15 +49,19 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function calendar_listEvents($startstamp, $endstamp)
     {
-        $result = $this->_registry->calendar->listEvents(
-                $startstamp,   // Start
-                $endstamp,     // End
-                null,          // Calendar
-                false,         // Recurrence
-                false,         // Alarms only
-                false,         // Show remote
-                true,          // Hide exception events
-                false);        // Don't return multi-day events on *each* day
+        try {
+            $result = $this->_registry->calendar->listEvents(
+                    $startstamp,   // Start
+                    $endstamp,     // End
+                    null,          // Calendar
+                    false,         // Recurrence
+                    false,         // Alarms only
+                    false,         // Show remote
+                    true,          // Hide exception events
+                    false);        // Don't return multi-day events on *each* day
+        } catch (Exception $e) {
+            return array();
+        }
         return $result;
     }
 
@@ -72,7 +76,11 @@ class Horde_ActiveSync_Driver_Horde_Connector_Registry
      */
     public function calendar_listBy($action, $from_ts, $to_ts)
     {
-        return $this->_registry->calendar->listBy($action, $from_ts, null, $to_ts);
+        try {
+            return $this->_registry->calendar->listBy($action, $from_ts, null, $to_ts);
+        } catch (Exception $e) {
+            return array();
+        }
     }
 
     /**
index 39c9e5a..6962171 100644 (file)
@@ -127,6 +127,12 @@ class Horde_ActiveSync_Request_GetItemEstimate extends Horde_ActiveSync_Request_
         /* Start getting the actual esitmates and outputting the results */
         $this->_encoder->startTag(self::GETITEMESTIMATE);
         foreach ($collections as $collection) {
+            $this->_state->init($collection);
+            try {
+                $this->_state->loadState($collection['synckey']);
+            } catch (Horde_ActiveSync_Exception $e) {
+                $status[$collection['id']] = self::STATUS_KEYMISM;
+            }
             $this->_encoder->startTag(self::RESPONSE);
             $this->_encoder->startTag(self::STATUS);
             $this->_encoder->content($status[$collection['id']]);
@@ -139,12 +145,8 @@ class Horde_ActiveSync_Request_GetItemEstimate extends Horde_ActiveSync_Request_
             $this->_encoder->content($collection['id']);
             $this->_encoder->endTag();
             $this->_encoder->startTag(self::ESTIMATE);
-
-            $this->_state->init($collection);
-            $this->_state->loadState($collection['synckey']);
             $sync = $this->_driver->getSyncObject();
             $sync->init($this->_state, null, $collection);
-
             $this->_encoder->content($sync->GetChangeCount());
             $this->_encoder->endTag();
             $this->_encoder->endTag();