From 977753dbd2989856d27fc96b6c1edfe91b17c22e Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Wed, 28 Apr 2010 12:49:08 -0400 Subject: [PATCH] catch exceptions from the registry connector --- .../ActiveSync/Driver/Horde/Connector/Registry.php | 28 ++++++++++++++-------- .../Horde/ActiveSync/Request/GetItemEstimate.php | 10 ++++---- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php index 0b4b44028..267240293 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Driver/Horde/Connector/Registry.php @@ -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(); + } } /** diff --git a/framework/ActiveSync/lib/Horde/ActiveSync/Request/GetItemEstimate.php b/framework/ActiveSync/lib/Horde/ActiveSync/Request/GetItemEstimate.php index 39c9e5a82..696217148 100644 --- a/framework/ActiveSync/lib/Horde/ActiveSync/Request/GetItemEstimate.php +++ b/framework/ActiveSync/lib/Horde/ActiveSync/Request/GetItemEstimate.php @@ -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(); -- 2.11.0