[OGo-GNUstep-Port] exception when entering a project

Sebastian Reitenbach gnustep-port@opengroupware.org
Tue, 27 Nov 2007 11:07:02 +0100


When I try to enter a project the following exception is raised:
Application Server caught exception:

  session: 2E812E8101474B404D
  element: 006474b405e89eeac08.0.17.1.3.b.attributes.1.37
  context: <0x0x89eeac08[WOContext]: 006474b405e89eeac08 app=ogo-webui-1.1 
sn=2E812E8101474B404D eid=006474b405e89eeac08.0.17.1.3.b.attributes.1.37 
rqeid=(nil)>
  request: <WORequest[0x0x898df508]: method=GET 
uri=/OpenGroupware.woa/x/activate?woinst=11905&oid=10536&wosid=2E812E8101474B404D

app=OpenGroupware rqKey=x rqPath=activate>

  class:   NSException
  name:    NSUnknownKeyException
  reason:  Unable to set nil value for key
  info:
    {NSTargetObjectUserInfoKey = "<EOGenericRecord: description ProjectInfo 
attributes={comment = \"\"; dbStatus = inserted; projectId = 10536; 
projectInfoId = 10537; }>"; NSUnknownUserInfoKey = comment; }


here is the backtrace from gdb:
#0  -[NSException raise] (self=0x8a5114c8, _cmd=0x2a759ca8) at 
NSException.m:782
#1  0x0a73fe28 in -[NSObject(KeyValueCoding) setValue:forUndefinedKey:] 
(self=0x85f5be08, _cmd=0x2a782510, anObject=0x85f5bec8,
    aKey=0x83bb8748) at NSKeyValueCoding.m:415
#2  0x0a7e6ddf in GSObjCSetVal (self=0x85f5be08, key=0xcfbd9080 "comment", 
val=0x85f5bec8, sel=0x0, type=0x2a782510 "+", size=7,
    offset=174841227) at GSObjCRuntime.m:1810
#3  0x0a73ec6c in SetValueForKey (self=0x85f5be08, anObject=0x85f5bec8, 
key=0xcfbd9080 "comment", size=7) at NSKeyValueCoding.m:124
#4  0x0a73fb8c in -[NSObject(KeyValueCoding) setValue:forKey:] 
(self=0x85f5be08, _cmd=0x218fb148, anObject=0x85f5bec8, aKey=0x83bb8e28)
    at NSKeyValueCoding.m:363
#5  0x01935095 in _setValue (self=0x858a6348, _value=0x85f5bec8) at 
WOKeyPathAssociation.m:920
#6  0x018ed840 in WOComponent_syncToParent (self=0x805f0308, 
_parent=0x86d7c388) at WOComponent+Sync.m:181
#7  0x018f128d in WOContext_leaveComponent (self=0x7d9ef008, 
_component=0x805f0308) at WOContext.m:444
#8  0x0190ec59 in -[WOChildComponentReference appendToResponse:inContext:] 
(self=0x7fe46088, _cmd=0x21903350, _response=0x8add8c88,
    _ctx=0x7d9ef008) at WOChildComponentReference.m:189
#9  0x01951655 in -[WOCompoundElement appendToResponse:inContext:] 
(self=0x8032a308, _cmd=0x218fdd88, _response=0x8add8c88,
    _ctx=0x7d9ef008) at WOCompoundElement.m:247
#10 0x01941871 in -[WOTemplate appendToResponse:inContext:] (self=0xa71f9e4, 
_cmd=0x218e3128, _response=0x8add8c88, _ctx=0x7d9ef008)
    at WOTemplate.m:128
#11 0x018ec40c in -[WOComponent appendToResponse:inContext:] 
(self=0x86d7c388, _cmd=0x28b036a8, _response=0x8add8c88, _ctx=0x7d9ef008)
    at WOComponent.m:924
#12 0x08b06c2d in -[OGoComponent appendToResponse:inContext:] 
(self=0x86d7c388, _cmd=0x218edbc0, _r=0x8add8c88, _ctx=0x7d9ef008)
    at OGoComponent.m:132
#13 0x0190ec4b in -[WOChildComponentReference appendToResponse:inContext:] 
(self=0x7c362ac8, _cmd=0x2426fc98, _response=0x8add8c88,
    _ctx=0x7d9ef008) at WOChildComponentReference.m:188
#14 0x042842be in -[WETabItem 
_appendBodyToResponse:inContext:activeKey:key:] (self=0x7c2e3f88, 
_cmd=0x2426fcc8, _response=0x8add8c88,
    _ctx=0x7d9ef008, tmp=0x8a1cfec8, k=0x896ddb88) at WETabItem.m:354
#15 0x04284604 in -[WETabItem appendToResponse:inContext:] (self=0x7c2e3f88, 
_cmd=0x27e14110, _response=0x8add8c88, _ctx=0x7d9ef008)
    at WETabItem.m:414
#16 0x07e1c67d in -[SkySimpleTabItem appendToResponse:inContext:] 
(self=0xa71f9e4, _cmd=0x21903358, _response=0x8add8c88,
    _ctx=0x7d9ef008) at SkySimpleTabItem.m:113
#17 0x01951682 in -[WOCompoundElement appendToResponse:inContext:] 
(self=0x8010b288, _cmd=0x24270d20, _response=0x8add8c88,
    _ctx=0x7d9ef008) at WOCompoundElement.m:252

(gdb) list NSKeyValueCoding.m:415
410           o = [NSObject instanceMethodForSelector:
411             @selector(handleTakeValue:forUnboundKey:)];
412         }
413       if ([self methodForSelector: 
@selector(handleTakeValue:forUnboundKey:)] != o)
414         {
415           [self handleTakeValue: anObject forUnboundKey: aKey];
416           return;
417         }
418     NSLog(@"NSKeyValueCoding.m: setValue: %@ forUndefinedKey: %@, i am 
self: %@", anObject, aKey, [self description]);
419       dict = [NSDictionary dictionaryWithObjectsAndKeys:
(gdb) list GSObjCRuntime.m:1810
1805            }
1806          type = [sig getArgumentTypeAtIndex: 2];
1807        }
1808      if (type == NULL)
1809        {
1810          [self setValue: val
1811         forUndefinedKey: [NSString stringWithUTF8String: key]];
1812        }
1813      else if ((val == nil || val == null) && *type != _C_ID && *type != 
_C_CLASS)
1814        {
(gdb) list NSKeyValueCoding.m:124
119                 {
120                   GSOnceFLog(@"Key-value access using _setKey: is 
deprecated:");
121                 }
122             }
123         }
124       GSObjCSetVal(self, key, anObject, sel, type, size, off);
125     }
126
127     static id ValueForKey(NSObject *self, const char *key, unsigned 
size)
128     {



The NSLog statement I added in NSKeyValueCoding.m:418 prints the following 
just before the exception is raised:
2007-11-27 10:45:27.485 ogo-webui-1.1[32682] NSKeyValueCoding.m: setValue: 
<EOGenericRecord: description ProjectInfo attributes={comment
 = ""; dbStatus = inserted; projectId = 10536; projectInfoId = 10537; }> 
forUndefinedKey: comment, i am self: <EOGenericRecord: descript
ion Project attributes={dbStatus = inserted; endDate = "2028-12-30 23:00:00 
+0000"; isFake = 0; kind = "<NSNull: 0x86c7de88>"; name = te
stproject; number = P10536; objectVersion = 1; ownerId = 10100; projectId = 
10536; startDate = "2007-11-25 23:00:00 +0000"; status = "<N
SNull: 0x86c7de88>"; teamId = "<NSNull: 0x86c7de88>"; url 
= "skyrix://defiant.ds9/ogo_instance0/"; }>

Some months ago, Helge fixed some similar problems here:
http://svn.opengroupware.org/viewcvs/trunk/WebUI/OGoFoundation/LSWLabelHandler.m?rev=1957&r1=1654&r2=1957

and here:
http://svn.opengroupware.org/viewcvs/trunk/Logic/LSAddress/_NSUserDefaults.m?rev=1961&r1=1658&r2=1961


by adding some methods.

I assume this problem could be fixed by adding a  -setValue:forUndefinedKey: 
method somewhere, but 
where should this be added to fix the problem?

any hint, and I'll try fixing it.

thanks
Sebastian