{ "id": "151703", "key": "TIMOB-19665", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2016-01-19T22:14:41.000+0000", "created": "2015-10-03T00:31:28.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [], "versions": [], "issuelinks": [ { "id": "49427", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "151676", "key": "TIMOB-19660", "fields": { "summary": "Android: 5.0.2 GA HTTPClient handleResponse error", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-01-19T22:14:47.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Steps to reproduce\r\nh3. Create xhr that pings an endpoint that returns 'true' or 'false\r\n{code}\r\nfunction doit() {\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload: function onLoad(e) {\r\n alert(\"Received: Status = \" + e.status + \", Value = \" + e.responseText);\r\n },\r\n onerror: function onError(e) {\r\n alert(\"Error: Status = \" + e.status + \", Value = \" + e.responseText);\r\n }\r\n });\r\n\r\n xhr.open(\"GET\", \"https://13b6379a34068a7bb6c483d30f362f550675a41c.cloudapp-enterprise.appcelerator.com/t\");\r\n xhr.send();\r\n}\r\n{code}\r\n\r\nh2. Error generated\r\n{code}\r\n[ERROR] TiHTTPClient: (TiHttpClient-1) [3054,3054] HTTP Error (java.lang.NullPointerException): Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference\r\n[ERROR] TiHTTPClient: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[] java.lang.String.split(java.lang.String)' on a null object reference\r\n[ERROR] TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:195)\r\n[ERROR] TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:84)\r\n[ERROR] TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1194)\r\n[ERROR] TiHTTPClient: \tat java.lang.Thread.run(Thread.java:818)\r\n{code}\r\n\r\nh2. Endpoint\r\n{code}\r\nfunction t(req, res){\r\n res.end((((new Date()).getTime() & 1) == 1).toString());\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Android java error when making HTTP request to endpoint that returns 'true' or 'false'", "creator": { "name": "stoda", "key": "stoda", "displayName": "Seth Toda", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "stoda", "key": "stoda", "displayName": "Seth Toda", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 517, "state": "closed", "name": "2015 Sprint 22 SDK", "startDate": "2015-10-24T00:30:42.059Z", "endDate": "2015-11-07T01:30:00.000Z", "completeDate": "2015-11-09T02:37:29.441Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "367611", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-23T02:56:50.000+0000", "updated": "2015-10-23T05:56:40.000+0000" }, { "id": "367706", "author": { "name": "stoda", "key": "stoda", "displayName": "Seth Toda", "active": true, "timeZone": "America/Los_Angeles" }, "body": "thanks [~msamah]\r\n", "updateAuthor": { "name": "stoda", "key": "stoda", "displayName": "Seth Toda", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-10-23T23:18:59.000+0000", "updated": "2015-10-23T23:18:59.000+0000" }, { "id": "368267", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Resolving issue as `Won't Fix`\r\n\r\nReason being the endpoint is not being detected as there is no header `Content-Type`. iOS and Android behaviour are the same.\r\nHTTP protocols docs https://tools.ietf.org/html/rfc7231#section-3.1.1.5\r\n\r\n{quote}\r\n A sender that generates a message containing a payload body SHOULD\r\n generate a Content-Type header field in that message unless the\r\n intended media type of the enclosed representation is unknown to the\r\n sender. If a Content-Type header field is not present, the recipient\r\n MAY either assume a media type of \"application/octet-stream\"\r\n ([RFC2046], Section 4.5.1) or examine the data to determine its type.\r\n{quote}\r\n\r\nThus the endpoint should set the header for iOS and Android client to get the proper payload.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-29T08:34:05.000+0000", "updated": "2015-10-29T08:34:05.000+0000" }, { "id": "368372", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Will look into this further.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-29T23:35:48.000+0000", "updated": "2015-10-29T23:35:48.000+0000" }, { "id": "368395", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Please run this code. This code will make it work.\r\n\r\n{code}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n \r\nvar win = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n \r\n \r\nvar button = Titanium.UI.createButton({\r\n\ttitle:'Press to click'\r\n});\r\n \r\nwin.add(button);\r\n \r\nbutton.addEventListener('click', function(e) {\r\n\t\r\n\tvar xhr = Ti.Network.createHTTPClient({\r\n onload: function(e) {\r\n alert(\"Received: Status = \" + this.status + \", Value = \" + this.responseText);\r\n Ti.API.info(\"Received: Status = \" + this.status + \", Value = \" + this.responseText);\r\n },\r\n onerror: function(e) {\r\n alert(\"Error: Status = \" + this.status + \", Value = \" + this.responseText, \" error:\" + e.error);\r\n }\r\n });\r\n \r\n \tvar args = {\r\n \t\tname: 'filename',\r\n \t\tfile: Ti.Filesystem.getFile(\"mytestfile.txt\")\r\n \t};\r\n \r\n xhr.open(\"GET\", \"https://13b6379a34068a7bb6c483d30f362f550675a41c.cloudapp-enterprise.appcelerator.com/t\");\r\n xhr.send();\r\n \r\n\r\n \r\n});\r\n \r\nwin.open();\r\n \r\n {code}\r\n\r\nResolving this as invalid as the code above will make it work.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-30T03:20:12.000+0000", "updated": "2015-10-30T03:20:12.000+0000" }, { "id": "368396", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Also, you can run `appc ti sdk install -d -b 5_0_X` to get the branch 5.0.3 which contains 5.0.2.GA with the fixes to the first error issue.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-10-30T03:28:31.000+0000", "updated": "2015-10-30T03:28:31.000+0000" } ], "maxResults": 18, "total": 18, "startAt": 0 } } }