From 94e17ffd295f50393d347b7b8585e9681028a182 Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 9 Nov 2004 14:42:58 +0000 Subject: [PATCH] appointment save is broken git-svn-id: http://svn.opengroupware.org/SOGo/trunk@448 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Appointments/ChangeLog | 5 +++++ .../Appointments/SOGoAppointmentObject.m | 21 ++++++++++++++----- SOGo/SoObjects/Appointments/Version | 2 +- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/SOGo/SoObjects/Appointments/ChangeLog b/SOGo/SoObjects/Appointments/ChangeLog index e6ff7181..b727ad48 100644 --- a/SOGo/SoObjects/Appointments/ChangeLog +++ b/SOGo/SoObjects/Appointments/ChangeLog @@ -1,3 +1,8 @@ +2004-11-09 Helge Hess + + * SOGoAppointmentObject.m: improved error handling in save method + (v0.9.16) + 2004-10-20 Helge Hess * SOGoAppointmentFolder.m: fixed a warning on MacOSX (v0.9.15) diff --git a/SOGo/SoObjects/Appointments/SOGoAppointmentObject.m b/SOGo/SoObjects/Appointments/SOGoAppointmentObject.m index d7ffe5b7..9da84603 100644 --- a/SOGo/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SOGo/SoObjects/Appointments/SOGoAppointmentObject.m @@ -205,12 +205,17 @@ 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 { @@ -231,7 +236,12 @@ /* 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 */ @@ -260,9 +270,10 @@ /* 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 */ diff --git a/SOGo/SoObjects/Appointments/Version b/SOGo/SoObjects/Appointments/Version index 8c1adff0..87351aca 100644 --- a/SOGo/SoObjects/Appointments/Version +++ b/SOGo/SoObjects/Appointments/Version @@ -1,5 +1,5 @@ # Version file -SUBMINOR_VERSION:=15 +SUBMINOR_VERSION:=16 # v0.9.13 requires libSOGo v0.9.26 -- 2.39.5