Hi!
I'm having an issue with the httpClient throwing a java.lang.Nullpointer exception seemingly randomly with GET requests. Doing the same requests multiple times one after another always inevitably results with the error (sometimes on the first few tries, other times later on). The returned status is 200.
I'm using SDK 4.0.0.GA
Here's a simplified code example:
var xhr = Ti.Network.createHTTPClient(); xhr.timeout = 10000; xhr.onerror = function(res){ alert(res.error); } module.exports = { getStuff : function(cb){ var q = { foo : bar }; q = JSON.stringify(q); q = Ti.Network.encodeURIComponent(q); var url = base_url +'foo?'+q; xhr.open('GET',url); xhr.onload = function(e){ var data = JSON.parse(this.responseText); cb(data); }; xhr.send(); } }Here's the log output:
[ERROR] : TiHttpClient: (TiHttpClient-26) [37083,37595] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException [INFO] : ALERT: (KrollRuntimeThread) [0,37595] java.lang.NullPointerException [ERROR] : TiHttpClient: java.lang.NullPointerException [ERROR] : TiHttpClient: at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1330) [ERROR] : TiHttpClient: at java.lang.Thread.run(Thread.java:856)
Someone has any ideas?