[TIMOB-1943] Android: stack overflow trying to read from file that doesn't exist
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | Trivial |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2011-04-17T01:57:36.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 1.5.0 |
| Components | Android |
| Labels | android, defect |
| Reporter | Bill Dawson |
| Assignee | Bill Dawson |
| Created | 2011-04-15T03:06:14.000+0000 |
| Updated | 2011-04-17T01:57:36.000+0000 |
Description
failcase app.js (assuming the file name aurelio.txt does not exist in the application data directory :) ):
Titanium.UI.setBackgroundColor('#000');
var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'aurelio.txt');
var blob = file.read();
var txt = blob.text;
If you run that, the app will crash, and if you look at the log you'll see a stack overflow.
Expected behavior: see a NullPointerException
instead. (Developers should check file.exists() before
trying to access the file.)
(from [2d6dc2218e90e485e5485379e9828d2ed0ec94bf]) [#1943 state:fixed-in-qa] In getInputStream, don't let caught exception fall throught to default of swtich statement http://github.com/appcelerator/titanium_mobile/commit/2d6dc2218e90e485e5485379e9828d2ed0ec94bf"> http://github.com/appcelerator/titanium_mobile/commit/2d6dc2218e90e...
1.4.2.4ce7ff G1 running 1.6, 2.2 simulator