My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 73: TouchJSON Fails with Invalid Format; Not enough error catching
3 people starred this issue and may be notified of changes. Back to list
Status:  Invalid
Owner:  ----
Closed:  Mar 2010


 
Reported by RoLYroLL...@gmail.com, Feb 9, 2010
What steps will reproduce the problem?

1. Use example provided in the Demo-->main.m
void test(void)
{
NSString *theSource = NULL;
//
theSource = @"{\"a\": [ { ] }";

NSData *theData = [theSource dataUsingEncoding:NSUTF32BigEndianStringEncoding];

NSError *theError = NULL;
id theObject = [[CJSONDeserializer deserializer] deserialize:theData error:&theError];

NSLog(@"Error: %@", theError);
NSLog(@"Result: %@", theObject);
}

2. Replace the source with an invalid JSON format
ie:
- theSource = @"HI";
- theSource = @"Service Unavailable";
etc.


What is the expected output? What do you see instead?

I see:
*** -[NSConcreteMutableData _fastCharacterContents]: unrecognized selector sent to instance 
0x3eabba0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -
[NSConcreteMutableData _fastCharacterContents]: unrecognized selector sent to instance 
0x3eabba0'

I would expect to receive a clean error and not just crash or maybe a return of NULL. 


What version of the product are you using? On what operating system?
TouchJSON 1.0.7 on iPhone SDK 3.1.2.


Please provide any additional information below.

I know I can probably do some of my own checking if the JSON format is somewhat clean and 
properly formatted. It would be nice, however, if your API would do the checking already built-
in.
Mar 19, 2010
Project Member #1 jwight
Do not use NSUTF32BigEndianStringEncoding.

Use UTF8.
Status: Invalid

Powered by Google Project Hosting