[OGo-Developer] _e_info in NSException.h

Sebastian Reitenbach developer@opengroupware.org
Tue, 15 Jan 2008 07:39:09 +0100


------=_=-_OpenGroupware_org_NGMime-21076-1200379149.446109-4------
content-type: text/plain; charset="us-ascii"
content-transfer-encoding: 7bit
content-length: 1712

Hi,

developer@opengroupware.org wrote: 
> 
> > I thought Helge cares a lot about Cocoa and whenever I come up with  
> > changes
> > he says it has to not break compiliation/running on cocoa, that is  
> > why I
> > wonder how it works there.
> 
> 
> That's pretty much context-sensitive. In general, we do care a lot  
> about Cocoa compatibility and compilation. For some things, i.e.  
> getting stack traces for exceptions in Cocoa, we don't have a working  
> implementation. This is not critical for running OGo/SOPE on top of  
> Cocoa, however, so it's no strict requirement . But of course we'd  
> like to have this feature. However, we must ensure that everything  
> compiles/runs on top of all foundations - this isn't always an easy  
> task.
> 
I think I found a solution.
 I got rid of all foundation related #ifdef and 
#if statements. I exchanged the step by step approach in creating the 
exception with [NSException initWithName: reason: userInfo]

this should be available in GNUstep, Apple, NeXT and libFoundation
http://www.cilinder.be/docs/next/NeXTStep/3.3/nd/Foundation/Classes/NSException.htmld/index.html

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSException_Class/Reference/Reference.html

http://svn.opengroupware.org/SOPE/trunk/libFoundation/Foundation/NSException.m
http://www.gnustep.org/resources/documentation/Developer/Base/ProgrammingManual/manual_6.html


therefore better compatible to all, makes code more readable, ...

I only tried this patch with gnustep-base-1.15.2, but as it is documented 
for all 4 foundation libs, it should work on the others too. 
Any objections to this change, is it fine to get into svn?

cheers
Sebastian


------=_=-_OpenGroupware_org_NGMime-21076-1200379149.446109-4------
content-disposition: inline; filename="patch-sope-mime_NGImap4_NGImap4Client_m"
content-length: 1148
content-transfer-encoding: 7bit
content-type: application/octet-stream; name="patch-sope-mime_NGImap4_NGImap4Client_m"

$OpenBSD$
--- sope-mime/NGImap4/NGImap4Client.m.orig	Tue Dec  4 11:00:36 2007
+++ sope-mime/NGImap4/NGImap4Client.m	Tue Jan 15 07:16:07 2008
@@ -53,18 +53,6 @@
 
 @end /* NGImap4Client(ConnectionRegistration); */
 
-#if GNUSTEP_BASE_LIBRARY
-/* FIXME: TODO: move someplace better (hh: NGExtensions...) */
-@implementation NSException(setUserInfo)
-
-- (id)setUserInfo:(NSDictionary *)_userInfo {
-  ASSIGN(self->_e_info, _userInfo);
-  return self;
-}
-
-@end /* NSException(setUserInfo) */
-#endif
-
 @interface NGImap4Client(Private)
 
 - (NSString *)_folder2ImapFolder:(NSString *)_folder;
@@ -967,9 +955,10 @@ static NSArray      *Imap4SystemFlags  = nil;
   descr = @"Could not process qualifier for imap search "; 
   descr = [descr stringByAppendingString:reason];           
   
-  exception = [[NGImap4SearchException alloc] initWithFormat:@"%@", descr];    
   ui = [NSDictionary dictionaryWithObject:_q forKey:@"qualifier"];
-  [exception setUserInfo:ui];
+  exception = [[NSException alloc] initWithName:@"NGImap4SearchException" 
+	reason:descr userInfo:ui];
+
   [self->context setLastException:exception];
   [exception release];
 }

------=_=-_OpenGroupware_org_NGMime-21076-1200379149.446109-4--------