[TIMOB-12992] Android: Ti.Network.HttpClient JSON response text is truncated
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-03-30T06:42:12.000+0000 |
Affected Version/s | Release 3.0.0, Release 3.0.2 |
Fix Version/s | 2013 Sprint 07 API, 2013 Sprint 07 |
Components | Android |
Labels | supportTeam, triage |
Reporter | Rupesh Sharma |
Assignee | Vishal Duggal |
Created | 2013-03-07T12:21:18.000+0000 |
Updated | 2017-03-29T22:36:46.000+0000 |
Description
In Ti.Network.HttpClient API this.responseText is truncated and incomplete in case of android while its complete in case of IOS.
Please find the attached app.js and media.js to reproduce the same. Folowing error occurs:
E/V8Exception( 2937): Exception occurred at app.js:22: Uncaught TypeError: Cannot read property '0' of undefined
E/XMLModule( 2937): (KrollRuntimeThread) [136,7131] Error parsing XML
E/XMLModule( 2937): org.xml.sax.SAXParseException: Unexpected token (position:TEXT )]}'{"conn": "mo...@1:10771 in java.io.InputStreamReader@4245c080)
E/XMLModule( 2937): at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
E/XMLModule( 2937): at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
E/XMLModule( 2937): at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:82)
E/XMLModule( 2937): at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:624)
E/XMLModule( 2937): at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:84)
E/XMLModule( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
E/XMLModule( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:58)
E/XMLModule( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:44)
E/XMLModule( 2937): at org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:71)
E/XMLModule( 2937): at android.os.Handler.handleCallback(Handler.java:615)
E/XMLModule( 2937): at android.os.Handler.dispatchMessage(Handler.java:92)
E/XMLModule( 2937): at android.os.Looper.loop(Looper.java:137)
E/XMLModule( 2937): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:109)
E/TiHttpClient( 2937): (KrollRuntimeThread) [13,7144] Error parsing XML
E/TiHttpClient( 2937): org.xml.sax.SAXParseException: Unexpected token (position:TEXT )]}'{"conn": "mo...@1:10771 in java.io.InputStreamReader@4245c080)
E/TiHttpClient( 2937): at org.apache.harmony.xml.parsers.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:146)
E/TiHttpClient( 2937): at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:107)
E/TiHttpClient( 2937): at ti.modules.titanium.xml.XMLModule.parse(XMLModule.java:82)
E/TiHttpClient( 2937): at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:624)
E/TiHttpClient( 2937): at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:84)
E/TiHttpClient( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method)
E/TiHttpClient( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:58)
E/TiHttpClient( 2937): at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:44)
E/TiHttpClient( 2937): at org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:71)
E/TiHttpClient( 2937): at android.os.Handler.handleCallback(Handler.java:615)
E/TiHttpClient( 2937): at android.os.Handler.dispatchMessage(Handler.java:92)
E/TiHttpClient( 2937): at android.os.Looper.loop(Looper.java:137)
E/TiHttpClient( 2937): at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:109)
Attachments
File | Date | Size |
---|---|---|
app.js | 2013-03-07T12:21:18.000+0000 | 1586 |
media.js | 2013-03-07T12:21:18.000+0000 | 1718 |
"Note to Self" http://support-admin.appcelerator.com/display/APP-768133
Is this true for all calls, or just the one in particular shown in the sample?
Using sample code above: verified does not occur with iOS verified occurs on Android with sample code, and changed the video ID in some tests: Droid 1 - 2.2.3 Nexus 4 - 4.2 Droid 3 - 2.3.4 Results differed slightly by OS, but common error: 03-14 15:32:21.531 1886 1894 E V8Exception: Exception occurred at app.js:23: Uncaught TypeError: Cannot read property '0' of undefined Droid 3 returned some JSON:
Nexus 4:
Droid 1:
Looks like user error. The function is defined without arguments (undefined) which is being accessed. Can you replace the setTimeout block with this code and retest
Resolving as invalid. If it is not user error, please reopen.
Not a user error
The response is not truncated. It just seems so because DDMS won't print out more than 4096 characters to output at a time. If you chunk the response while writing you can see all of it. What is actually happening is that the responses being received are completely different From my debugging here are the video nodes of content that I am getting
The response on android has no fmt_stream_map property in the video node which explains the error thrown. No idea what parameters control the response from the server. Either ways the bug filed in this ticket is invalid. Response is not truncated and JSON is parsed correctly. Going to mark this as invalid.
in iOS simulator, it also happens, i query ACS by HttpClient, the response text is truncated, so i can not parse it to object. // url [INFO]:https://api.cloud.appcelerator.com/v1/photos/query.json?key=appkey&page=1&per_page=50&where={"tags_array":{"$in":["51c48e33cde8cd0b25062b75","51c2c9892cf68f0ad308d423","51c2924b66b7ae0ae209b18c","51c0525fc1b9a60ad306a57d","51c04d1a66b7ae0ae20633f7"]}} // cut response [INFO] : { [INFO] : "meta": { [INFO] : "code": 200, [INFO] : "status": "ok", [INFO] : "method_name": "queryPhoto", [INFO] : "page": 1, [INFO] : "per_page": 50, [INFO] : "total_pages": 1, [INFO] : "total_results": 9 [INFO] : }, [INFO] : "response": { [INFO] : "photos": [ [INFO] : { [INFO] : "id": "51c052962408fd0aee000a37", [INFO] : "filename": "1f9a85f0.jpeg", [INFO] : "size": 4861117, [INFO] : "md5": "4778a3899f82abdd93d14e96a32bccda", [INFO] : "created_at": "2013-06-18T12:29:11+0000", [INFO] : "updated_at": "2013-06-18T12:29:19+0000", [INFO] : "processed": true, [INFO] : "user": { [INFO] : "id": "51bef7922408fd0aff000644", [INFO] : "first_name": "Jack", [INFO] : "last_name": "Jack", [INFO] : "created_at": "2013-06-17T11:48:35+0000", [INFO] : "updated_at": "2013-06-20T01:40:49+0000", [INFO] : "external_accounts": [ [INFO] : ], [INFO] : "confirmed_at": "2013-06-17T11:48:35+0000", [INFO] : "email": "jack@a.a", [INFO] : "admin": "false", [INFO] : "photo": { [INFO] : "id": "51bef7922408fd0aee000645", [INFO] : "filename": "20999c80.jpeg", [INFO] : "size": 4350073, [INFO] : "md5": "e262dfa4e9b19a3db4efb7f5c6cbbc38", [INFO] : "created_at": "2013-06-17T11:48:35+0000", [INFO] : "updated_at": "2013-06-17T11:48:39+0000", [INFO] : "processed": true, [INFO] : "urls": { [INFO] : "original": "http://storage.cloud.appcelerator.com/r7C550RQ3joq3v1TAJ8PKqN8uiy226On/photos/bc/38/51bef7932408fd0aff000646/20999c80_original.jpeg", [INFO] : "avatar": "http://storage.cloud.appcelerator.com/r7C550RQ3joq3v1TAJ8PKqN8uiy226On/photos/bc/38/51bef7932408fd0aff000646/20999c80_avatar.jpeg" [INFO] : }, [INFO] : "content_type": "image/jpeg" [INFO] : } [INFO] : }, [INFO] : "tags": [ [INFO] : "51c0525fc1b9a60ad306a57d" [INFO] : ], [INFO] : "urls": { [INFO] : "thumb": "http://storage.clo // here, the response is cut
Closing ticket as invalid.