Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2439] Android: TiBlob.text sometimes returns null

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:59:06.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M03
ComponentsAndroid
Labelsandroid, defect, filesystem, rplist
ReporterBill Dawson
AssigneeBill Dawson
Created2011-04-15T03:19:54.000+0000
Updated2011-04-17T01:59:06.000+0000

Description

Cf. https://developer.appcelerator.com/helpdesk/view/57781">Helpdesk 57781.

Failcase app.js:

Titanium.UI.setBackgroundColor('#000');
var text = "This is my text";
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test');
if (file.exists()) { 
    file.deleteFile();
}
file.write(text);
// nullify and re-create to test
file = null;
file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'test');
Ti.API.info('file.exists(): ' + file.exists());
var blob = file.read();
var readText = blob.text;
Ti.API.info(readText);

Before fix, that last info line will show null.

Comments

  1. Bill Dawson 2011-04-15

    (from [b690ce4941073cc1309ca9517d4465ff3da14b27]) [#2439 state:fixed-in-qa] Relax restriction (which I added a while ago) concerning whether to read a blob as utf-8 text. Only avoid it if the mime type is known binary. Set XHR->blob mimetype since it's known. Add unit test. https://github.com/appcelerator/titanium_mobile/commit/b690ce4941073cc1309ca9517d4465ff3da14b27"> https://github.com/appcelerator/titanium_mobile/commit/b690ce494107...

  2. Matt Schmulen 2011-04-15

    Pass Titanium SDK version: 1.5.0 (12/01/10 09:30 ac7cfd8) drillbit test Android Sim 1.6/2.1

    android sim 1.6
    https://5111068499667359260-a-appcelerator-com-s-sites.googlegroups.com/a/appcelerator.com/android/screenshots/Screenshot2010-12-02at2.30.47AM.png?attachauth=ANoY7crKsfvMfdez3l27wnG_vOB0igXOd2AW8GVzP33R4KO4JNDSdg0wYeWx8OR34RLcQs0pfHxUiuoIsoVb5OClouqEI_CmWLRvbhD64WJg7KiGw4U6-679XjvXSqApaVCVyGqDjjfcHnceQepDqw0Wky44GDYZpomldZ1mAY0K0qqkI_BWhN2ETrFqCIPUjsjX6ZtLnuIJ5H1eYOg2P-M9OoYJKY6_TozjeA9AGUlbA3qoW-OTVh0%3D&;attredirects=0"> https://5111068499667359260-a-appcelerator-com-s-sites.googlegroups...

    android sim 2.1
    https://5111068499667359260-a-appcelerator-com-s-sites.googlegroups.com/a/appcelerator.com/android/screenshots/Screenshot2010-12-02at2.48.13AM.png?attachauth=ANoY7cqZMHs0_-0NFdd52s4sE13MK769EMBj1VEL9mkQdyPJ_1Lylg56ioZ3EKIhrSl7RMoVTCAI9cY4-jfDs6mOqdJOyP9mQrY28Zjh5vBQGQ6_377a21CU3cn9Al6-wi8damB2gpx5waY3FoILV9l9iIqifi6D5Jue3Rbig8yVLAwmls-q_qLFApWfmRmL9V7zuCx18cVF9-Om9uMmhzz7EKdEBj6cJ1MuzGF5vuOn6vTnexNmgr0%3D&;attredirects=0"> https://5111068499667359260-a-appcelerator-com-s-sites.googlegroups...

JSON Source