Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

100% crashed when get a json #135

Closed
huabin opened this issue Nov 24, 2017 · 3 comments
Closed

100% crashed when get a json #135

huabin opened this issue Nov 24, 2017 · 3 comments

Comments

@huabin
Copy link

huabin commented Nov 24, 2017

Cocoa Rest Client Version: 1.4.3 (26)

macOS Version: 10.13.2

reproduce:

  1. open cocoarestclient

  2. input https://chainz.cryptoid.info/explorer/api.dws?q=summary

  3. method GET

  4. submit, and you will get the crash.

@mmattozzi
Copy link
Owner

Well, that's interesting... looks like it's coming from the JSON library I've used, json-framework.

2017-11-28 08:36:00.514323-0500 CocoaRestClient[61562:43681851] *** Assertion failure in -[SBJson4Parser parserFound:isValue:], /Users/mmattozzi/code/cocoa-rest-client/Pods/SBJson/src/main/objc/SBJson4Parser.m:151
2017-11-28 08:36:00.516186-0500 CocoaRestClient[61562:43681851] [General] An uncaught exception was raised
2017-11-28 08:36:00.516210-0500 CocoaRestClient[61562:43681851] [General] Invalid parameter not satisfying: obj

I'll have to poke around on this a little bit.

@mmattozzi
Copy link
Owner

mmattozzi commented Nov 30, 2017

The data returned by that URL appears to contain an invalid character:

"PoW" : "Scrypt² PoWT",

In theory, JSON should be either UTF-8 or UTF-16, but that character doesn't appear to be either -- it might be ISO-8859. The JSON library I'm using for pretty printing doesn't even support UTF-16 (see: SBJson/SBJson#115) so it seems like it has a tight coupling on UTF-8... and in fact the line of code that is crashing the entire program is trying to create a new String assuming a UTF8 encoding while tokenizing that character.

Long story short... I think at best I will have to catch the error to prevent the crash but then display the text without pretty printing.

mmattozzi added a commit that referenced this issue Nov 30, 2017
@mmattozzi
Copy link
Owner

Fixed in Version 1.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants