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

Group
 
 

bug #21343: KVC implementation throws uncaught exception parsing BOOLs

Submitter:  Larry Campbell <lcampbel>
Submitted:  Mon 15 Oct 2007 04:02:47 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Declined
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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>
Group 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-10-15 CaS Open/ClosedOpen Declined

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code