{ "id": "160727", "key": "AC-3721", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2016-06-12T05:02:33.000+0000", "created": "2016-06-02T20:16:06.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-06-13T02:07:13.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": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I'm using method Ti.Network.createHTTPClient in order to call a php service passing post variables.\r\n\r\nI get a java.lang.NullPointerException", "attachment": [], "flagged": false, "summary": "TiHTTPClient java.lang.NullPointerException", "creator": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Node.js Version = 4.4.4\r\nnpm Version = 2.15.1\r\nTitanium CLI CLI Version = 5.0.6\r\nTitanium SDK\r\nSDK Version = 5.2.2.GA\r\nTarget Platform = android", "comment": { "comments": [ { "id": "387454", "author": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[ERROR] : TiHTTPClient: (TiHttpClient-2) [732,732] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException\r\n[ERROR] : TiHTTPClient: java.lang.NullPointerException\r\n[ERROR] : TiHTTPClient: \tat com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:783)\r\n[ERROR] : TiHTTPClient: \tat com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)\r\n[ERROR] : TiHTTPClient: \tat com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)\r\n[ERROR] : TiHTTPClient: \tat com.android.okhttp.internal.http.HttpURLConnectionImpl.getHeaderField(HttpURLConnectionImpl.java:143)\r\n[ERROR] : TiHTTPClient: \tat java.net.URLConnection.getHeaderFieldInt(URLConnection.java:544)\r\n[ERROR] : TiHTTPClient: \tat java.net.URLConnection.getContentLength(URLConnection.java:316)\r\n[ERROR] : TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient.handleResponse(TiHTTPClient.java:159)\r\n[ERROR] : TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient.access$1200(TiHTTPClient.java:85)\r\n[ERROR] : TiHTTPClient: \tat ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1207)\r\n[ERROR] : TiHTTPClient: \tat java.lang.Thread.run(Thread.java:841)", "updateAuthor": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-02T20:16:33.000+0000", "updated": "2016-06-02T20:16:33.000+0000" }, { "id": "387455", "author": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "body": "var client = Ti.Network.createHTTPClient({\r\n // function called when the response data is available\r\n onload : function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n // function called when an error occurs, including a timeout\r\n onerror : function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n timeout : 5000 // in milliseconds\r\n });\r\n // Prepare the connection.\r\n //client.open(\"POST\", url);\r\n \t\tclient.open(\"POST\", url);\r\n\t\tclient.send({\r\n\t\t\t\"type\" : \"getcategories\",\r\n\t\t\t\"sourcetype\" : \"source_app\",\r\n\t\t});\r\n\t\r\n", "updateAuthor": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-02T20:17:19.000+0000", "updated": "2016-06-05T22:13:31.000+0000" }, { "id": "387456", "author": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Of course if I call the php file from my browser I get the http response without any problem", "updateAuthor": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-02T20:33:42.000+0000", "updated": "2016-06-02T20:33:42.000+0000" }, { "id": "387606", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Testing this with:\r\n{code}\r\nvar url = \"http://mockbin.com/request?foo=bar&foo=baz\";\r\nvar client = Ti.Network.createHTTPClient({\r\n // function called when the response data is available\r\n onload: function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n // function called when an error occurs, including a timeout\r\n onerror: function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n timeout: 5000 // in milliseconds\r\n});\r\n// Prepare the connection.\r\n//client.open(\"POST\", url);\r\nclient.open(\"POST\", url);\r\n//Set headers here.\r\n//client.setRequestHeader('Content-Type','text/csv');\r\nclient.send({\r\n \"type\": \"getcategories\",\r\n \"sourcetype\": \"source_app\",\r\n});\r\n{code}\r\nI do not find any issues. Could it be that your server expects something in the headers which causes it to give a wrong response?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-06-06T02:35:33.000+0000", "updated": "2016-06-06T02:35:33.000+0000" }, { "id": "387955", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, I can reconfirm that the issue is not occurring with Ashraf Abu's code. Can you follow his guide, or provide more info?\r\n\r\nRegards,\r\nSharif.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-06-09T17:06:57.000+0000", "updated": "2016-06-09T17:06:57.000+0000" }, { "id": "388118", "author": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I re-installed Titanium sdk, and everything is ok now, tsk", "updateAuthor": { "name": "freedevcom", "key": "freedevcom", "displayName": "Andrea", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-06-11T09:23:41.000+0000", "updated": "2016-06-11T09:23:41.000+0000" }, { "id": "388164", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "That's good to hear. Let us know if this reproduces again some how.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-06-13T02:07:13.000+0000", "updated": "2016-06-13T02:07:13.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }