}
// Get state of hierarchy
- $syncstate = $this->_stateMachine->loadState($synckey);
- $newsynckey = $this->_stateMachine->getNewSyncKey($synckey);
+ try {
+ $syncstate = $this->_stateMachine->loadState($synckey);
+ $newsynckey = $this->_stateMachine->getNewSyncKey($synckey);
+ } catch (Horde_ActiveSync_Exception $e) {
+ // @TODO - send error status keymism when refactored.
+ }
// additional information about already seen folders
$seenfolders = unserialize($this->_stateMachine->loadState('s' . $synckey));
try {
/* Get folders that we know about already */
$state->loadState($synckey);
+
+ /* Get new synckey to send back */
+ $newsynckey = $state->getNewSyncKey($synckey);
} catch (Horde_ActiveSync_Exception $e) {
$this->_statusCode = self::STATUS_KEYMISM;
$this->_handleError();
exit;
}
$seenfolders = $state->getKnownFolders();
-
- /* Get new synckey to send back */
- $newsynckey = $state->getNewSyncKey($synckey);
$this->_logger->debug('[Horde_ActiveSync::handleFolderSync] newSyncKey: ' . $newsynckey);
/* Deal with folder hierarchy changes */
if (isset($collection['importedchanges']) ||
isset($collection['getchanges']) ||
$collection['synckey'] == '0') {
-
- $collection['newsynckey'] = $state->getNewSyncKey($collection['synckey']);
+ try {
+ $collection['newsynckey'] = $state->getNewSyncKey($collection['synckey']);
+ } catch (Horde_ActiveSync_Exception $e) {
+ $this->_statusCode = self::STATUS_KEYMISM;
+ }
}
$this->_encoder->startTag(Horde_ActiveSync::SYNC_FOLDER);
* @param string $syncKey The old syncKey
*
* @return string The new synckey
+ * @throws Horde_ActiveSync_Exception
*/
static public function getNewSyncKey($syncKey)
{
return '{' . $matches[1] . '}' . $n;
}
-
- // @TODO: should this thrown an exception instead of returning false?
- return false;
+ throw new Horde_ActiveSync_Exception('Invalid SyncKey format passed to getNewSyncKey()');
}
}