[TIMOB-20247] Regression in android HTTPClient
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2017-05-10T21:31:15.000+0000 |
Affected Version/s | Release 5.1.2 |
Fix Version/s | Release 6.1.0 |
Components | n/a |
Labels | merge-6.1.0 |
Reporter | Szymon Tomasz Stefanek |
Assignee | Joshua Quick |
Created | 2016-01-13T01:24:55.000+0000 |
Updated | 2017-05-12T21:27:06.000+0000 |
Description
https://github.com/appcelerator/titanium_mobile/blob/master/android/modules/network/src/java/ti/modules/titanium/network/TiHTTPClient.java
Line 160: setReadyState(READY_STATE_HEADERS_RECEIVED) is called before the headers are actually set. Calling getResponseHeader() will result in an attempt to invoke the isEmpty() method on null responseHeaders member.
Just try to call getResponseHeaders() inside the onreadystatechange handler (when state is READY_STATE_HEADERS_RECEIVED or READY_STATE_LOADING).
Btw, it won't return null: it will trigger an exception at java level.
Hello [~s.stefanek], I am trying the below code in Android 5.1.0 with SDK 5.1.2.GA. Check if it's right.
Thanks.
PR: https://github.com/appcelerator/titanium_mobile/pull/8997
[~ybanev] The PR is for Master. Currently master is 6.2.0, so we need a PR for 6.1.0.
PR 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9001
Verified fix on SDK version 6.2.0.v20170512073825 and SDK version 6.1.0.v20170512073723. Test and other information can be found at: Master:https://github.com/appcelerator/titanium_mobile/pull/8997 6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9001