bugGNUstep - Bugs: bug #21343, KVC implementation throws uncaught...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #21343: KVC implementation throws uncaught exception parsing BOOLs

Submitted by:  Larry Campbell <lcampbel>
Submitted on:  Mon 15 Oct 2007 04:02:47 PM UTC  
 
Category: Base/FoundationSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Declined

Mon 15 Oct 2007 04:55:29 PM UTC, comment #3:

Ah... apparently I had run into this years ago, and added -{NSString charValue] to one of my frameworks, and forgotten about it, which is why my program didn't fail on MacOS X. OK, I think it's silly for KVC to fail in this way but if Mac OS X fails the same way then I guess I can buy the compatibility argument. Thanks.

Larry Campbell <lcampbel>
Mon 15 Oct 2007 04:39:53 PM UTC, comment #2:

PS. if an application wants to use nsstring it can of course add unsignedCharValue and charValue in a category

Richard Frith-Macdonald <CaS>
Project Member
Mon 15 Oct 2007 04:38:25 PM UTC, comment #1:

This exception is correct as far as I can see ... a string doesn't respond to unsignedCharValue so using it to supply the content of a boolean ivar would appear to be an application error. The application should be using an NSValue/NSNumber rather than a string.

I'm a little surprised that it's not raising an exception with charValue (which is what happens on MacOS-X intel), but I guess the compiler must be compiling a BOOL ivar as having a typoe description of unsigned char rather than signed char.

Richard Frith-Macdonald <CaS>
Project Member
Mon 15 Oct 2007 04:02:47 PM UTC, original submission:

gnustep-base doesn't supply -[NS(Constant)String unsignedCharValue], but its KVC
implementation uses it for parsing BOOLs. So if you try to setValue:forKey: a BOOL ivar, you get this:

<NSException: 8112048> NAME:NSInvalidArgumentException REASON:NSConstantString(instance) does not recognize unsignedCharValue

The fix is simple: provide -[NSString unsignedCharValue].

Larry Campbell <lcampbel>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by CaS (Posted a comment)
  • -unavailable- added by lcampbel (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 15 Oct 2007 04:38:25 PM UTCCaSOpen/ClosedOpen=>Declined

    Back to the top


    Powered by Savane 3.1-cleanup1