Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1649] Android: HTTPClient.send with no Argument causes NPE

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:56:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M01
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeMarshall Culpepper
Created2011-04-15T02:58:22.000+0000
Updated2011-04-17T01:56:46.000+0000

Description

Treat no argument as send({});. See http://developer.appcelerator.com/helpdesk/view/38031">Helpdesk 38031

To work around simply use an empty dictionary. http.send({});

Simple fail case app.js:

Titanium.UI.setBackgroundColor('#000');
var http = Ti.Network.createHTTPClient();
http.onerror = function(e) {
    Ti.API.error(e.error);
};
http.open('POST','http://www.appcelerator.com');
http.send();
Ti.API.info('after send call');

In the console you will see an error notice of a NullPointerException

Comments

  1. Luke Melia 2011-04-15

    Hmm, I am running into a case where this workaround doesn't avoid the NPE. (I'm the original reporter from Helpdesk 38031). I'll try to isolate it further, but it is a simple POST.

  2. Luke Melia 2011-04-15

    Confirmed that it's the same bug. If I build from source with the guard commented out, it works fine.

  3. Don Thorp 2011-04-15

    Raising the priority.

  4. Bill Dawson 2011-04-15

    (from [1c38abac9bea7598b1fa46de18a34e472343454c]) [#1649 state:fixed-in-qa] Do not try to add null form entity to request https://github.com/appcelerator/titanium_mobile/commit/1c38abac9bea7598b1fa46de18a34e472343454c"> https://github.com/appcelerator/titanium_mobile/commit/1c38abac9bea...

  5. Matt Schmulen 2011-04-15

    passed regression tested against android 1.6 sim

  6. Don Thorp 2011-04-15

    Matt are you running against more than one sim? If not once you've verified it fixed, please move it into the resolved state when you comment.

    Thanks for tackling these, it's a big help.

  7. Matt Schmulen 2011-04-15

    Yes, I will run it against 1.6 then 2.1 and then move it to fixed state; unfortunately once a sim is up its a pain to restart it so I have to walk the list with 1.6 and then go back and do them again against 2.1. In the past I have run multiple sims at a time, but my new machine doesn't seem to have the power to handle it. If you thing of a better way let me know.

  8. Matt Schmulen 2011-04-15

    passed regression tested against android 2.1 sim.

JSON Source