{ "id": "63824", "key": "TIMOB-3192", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "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": [ { "id": "11244", "name": "Release 1.7.0", "archived": true, "released": true, "releaseDate": "2011-06-13" }, { "id": "11246", "name": "Sprint 2011-11", "archived": true, "released": true, "releaseDate": "2011-03-21" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2011-04-26T09:13:25.000+0000", "created": "2011-04-15T03:39:08.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "defect", "reported-1.5.1" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-26T09:13:25.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": "{html}

HTTPClient crashes when the HTTP Response sent is 0 bytes\nlong.

\n

Versions:

\n\n

Debugging Trace:

\n
\n[TRACE] D/TiHttpClient( 1727): (kroll$1) [96,2260] Setting ready state to 1\n[TRACE] W/TiTabActivity( 1727): (main) [94,2354] Notifying TiTabGroup, activity is created\n[TRACE] D/qemud ( 38): fdhandler_accept_event: accepting on fd 10\n[TRACE] D/qemud ( 38): created client 0x2c938 listening on fd 15\n[TRACE] D/qemud ( 38): client_fd_receive: attempting registration for service 'sensors'\n[TRACE] D/qemud ( 38): client_fd_receive: -> received channel id 20\n[TRACE] D/qemud ( 38): client_registration: registration succeeded for client 20\n[TRACE] D/qemud ( 38): fdhandler_event: disconnect on fd 15\n[TRACE] I/ActivityManager( 60): Displayed activity unittest.httpclient/ti.modules.titanium.ui.TiTabActivity: 2466 ms (total 2466 ms)\n[TRACE] D/dalvikvm( 1727): GC_FOR_MALLOC freed 3458 objects / 210168 bytes in 150ms\n[TRACE] D/TiHttpClient( 1727): (TiHttpClient-1) [4134,6488] Setting ready state to 2\n[TRACE] D/TiHttpClient( 1727): (TiHttpClient-1) [2,6490] Setting ready state to 3\n[TRACE] E/TiHttpClient( 1727): (TiHttpClient-1) [10,6500] HTTP Error (java.lang.NullPointerException): java.lang.NullPointerException\n[TRACE] E/TiHttpClient( 1727): java.lang.NullPointerException\n[TRACE] E/TiHttpClient( 1727): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.finishedReceivingEntityData(TiHTTPClient.java:316)\n[TRACE] E/TiHttpClient( 1727): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:252)\n[TRACE] E/TiHttpClient( 1727): at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:165)\n[TRACE] E/TiHttpClient( 1727): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)\n[TRACE] E/TiHttpClient( 1727): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)\n[TRACE] E/TiHttpClient( 1727): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:997)\n[TRACE] E/TiHttpClient( 1727): at java.lang.Thread.run(Thread.java:1096)\n[TRACE] I/TiHttpClient( 1727): (TiHttpClient-1) [28,6528] Sending error java.lang.NullPointerException\n[TRACE] W/TiConvert( 1727): (kroll$1) [28,6556] Unsupported type class ti.modules.titanium.network.HTTPClientProxy\n[ERROR] [3,6559] HTTPClient error={\"error\":\"java.lang.NullPointerException\"}\n
\n

Repo steps:

\n\n
\nvar xhr = Titanium.Network.createHTTPClient();\nxhr.onerror = function (e) {\n    Ti.API.error('HTTPClient error='+JSON.stringify(e));\n};\nxhr.onload = function () {\n    Ti.API.info('status=' + xhr.status);\n    Ti.API.info('responseText=' + xhr.responseText);\n    Ti.API.info('responseText=' + xhr.responseText);\n};\nxhr.open('GET', 'http://www.danielcameron.com/m/empty.html'); // can replace with any HTTP request for a 0 byte file\nxhr.send();\n
{html}", "attachment": [], "flagged": false, "summary": "HTTPClient crashes with java.lang.NullPointerException for 0 length responses", "creator": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "130255", "author": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Titanium also crashes when sending null post parameters:
\nxhr.send({ somearg: 'ok', thisCrashesApp: null });

\n
\n[TRACE] D/TiHttpClient( 511): (kroll$1) [53,1686] Setting ready state to 1\n[TRACE] E/KrollMethod( 511): (kroll$1) [18,1704] Exception calling kroll method send, invocation: null ]\n[TRACE] E/KrollMethod( 511): java.lang.NullPointerException\n[TRACE] E/KrollMethod( 511): at ti.modules.titanium.network.TiHTTPClient.send(TiHTTPClient.java:861)\n[TRACE] E/KrollMethod( 511): at ti.modules.titanium.network.HTTPClientProxy.send(HTTPClientProxy.java:88)\n[TRACE] E/KrollMethod( 511): at ti.modules.titanium.network.HTTPClientProxyBindingGen$17.invoke(HTTPClientProxyBindingGen.java:584)\n[TRACE] E/KrollMethod( 511): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:48)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1711)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)\n[TRACE] E/KrollMethod( 511): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)\n[TRACE] E/KrollMethod( 511): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:195)\n[TRACE] E/KrollMethod( 511): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:220)\n[TRACE] E/KrollMethod( 511): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:115)\n[TRACE] E/KrollMethod( 511): at android.os.Handler.dispatchMessage(Handler.java:95)\n[TRACE] E/KrollMethod( 511): at android.os.Looper.loop(Looper.java:123)\n[TRACE] E/KrollMethod( 511): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)\n[TRACE] W/TiTabActivity( 511): (main) [96,1800] Notifying TiTabGroup, activity is created\n[TRACE] E/KrollContext( 511): (kroll$1) [2,1802] Error evaluating source: Wrapped java.lang.NullPointerException (app://app.js#77)\n[TRACE] E/KrollContext( 511): org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (app://app.js#77)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1781)\n[TRACE] E/KrollContext( 511): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:85)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:1711)\n[TRACE] E/KrollContext( 511): at script(app://app.js:77)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:854)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)\n[TRACE] E/KrollContext( 511): at org.mozilla.javascript.Context.evaluateReader(Context.java:1142)\n[TRACE] E/KrollContext( 511): at org.appcelerator.titanium.kroll.KrollContext.evaluateScript(KrollContext.java:195)\n[TRACE] E/KrollContext( 511): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:220)\n[TRACE] E/KrollContext( 511): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:115)\n[TRACE] E/KrollContext( 511): at android.os.Handler.dispatchMessage(Handler.java:95)\n[TRACE] E/KrollContext( 511): at android.os.Looper.loop(Looper.java:123)\n[TRACE] E/KrollContext( 511): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:73)\n[TRACE] E/KrollContext( 511): Caused by: java.lang.NullPointerException\n[TRACE] E/KrollContext( 511): at ti.modules.titanium.network.TiHTTPClient.send(TiHTTPClient.java:861)\n[TRACE] E/KrollContext( 511): at ti.modules.titanium.network.HTTPClientProxy.send(HTTPClientProxy.java:88)\n[TRACE] E/KrollContext( 511): at ti.modules.titanium.network.HTTPClientProxyBindingGen$17.invoke(HTTPClientProxyBindingGen.java:584)\n[TRACE] E/KrollContext( 511): at org.appcelerator.kroll.KrollMethod.call(KrollMethod.java:48)\n[TRACE] E/KrollContext( 511): ... 13 more\n[TRACE] E/TiContext( 511): (kroll$1) [49,1851] Rhino Error: app://app.js:77,0\n[TRACE] E/TiContext( 511): (kroll$1) [3,1854] Message: Wrapped java.lang.NullPointerException (app://app.js#77)\n[TRACE] E/TiContext( 511): (kroll$1) [1,1855] Source: null\n
{html}", "updateAuthor": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:08.000+0000", "updated": "2011-04-15T03:39:08.000+0000" }, { "id": "130256", "author": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Assigning to hopefully the correct person.

{html}", "updateAuthor": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:09.000+0000", "updated": "2011-04-15T03:39:09.000+0000" }, { "id": "130257", "author": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "body": "{html}

Created, new ticket #3358 for the issue regarding send with a\nnull value.

\n

In regards to the original issue, I am unable to reproduce on\nlatest build on master. Is someone else able to confirm that this\nis still an issue on the latest build?

{html}", "updateAuthor": { "name": "opiecyrus", "key": "opiecyrus", "displayName": "Opie Cyrus", "active": true, "timeZone": "America/Chicago" }, "created": "2011-04-15T03:39:09.000+0000", "updated": "2011-04-15T03:39:09.000+0000" }, { "id": "130258", "author": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Titanium Mobile SDK 1.6.1
\nAndroid SDK r10
\nRetested with above versions with an APIs 2.2 emulator and no\nlonger crashing. Looks like it got fixed somewhere between 1.5.1\nand 1.6.1.

{html}", "updateAuthor": { "name": "danielcameron", "key": "danielcameron", "displayName": "Daniel Cameron", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T03:39:09.000+0000", "updated": "2011-04-15T03:39:09.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }