unsigned i, count;
NSException *storeError, *delError;
+ if ([_iCal length] == 0) {
+ return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
+ reason:@"got no iCalendar content to store!"];
+ }
+
/* handle old content */
oldContent = [self iCalString]; /* if nil, this is a new appointment */
if ([oldContent length] == 0) {
/* new appointment */
- [self debugWithFormat:@"saving new appointment ..."];
+ [self debugWithFormat:@"saving new appointment: %@", _iCal];
oldApt = nil;
}
else {
/* handle new content */
newApt = [[[SOGoAppointment alloc] initWithICalString:_iCal] autorelease];
- newUIDs = [self attendeeUIDsFromAppointment:newApt];
+ if (newApt == nil) {
+ return [NSException exceptionWithHTTPStatus:400 /* Bad Request */
+ reason:@"could not parse iCalendar content!"];
+ }
+ if ((newUIDs = [self attendeeUIDsFromAppointment:newApt]) == nil)
+ [self debugWithFormat:@"got no UIDs from appointment: %@", newApt];
/* diff */
/* new ID which is not part of the old set => store a new */
[storeUIDs addObject:uid];
}
-
- [self debugWithFormat:@"store: %@", storeUIDs];
- [self debugWithFormat:@"remove: %@", removedUIDs];
+
+ [self debugWithFormat:
+ @"UID ops:\n new: %@\n old: %@\n store: %@\n remove: %@",
+ newUIDs, oldUIDs, storeUIDs, removedUIDs];
/* perform */