[TIMOB-5756] Android: TableView deleteRow with invalid index crashes the application instead of warning
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-06-30T00:26:31.000+0000 |
Affected Version/s | Release 1.8.0 |
Fix Version/s | 2013 Sprint 14, 2013 Sprint 14 API, Release 3.2.0 |
Components | Android |
Labels | parity, qe-testadded, tbs-2.1.0 |
Reporter | Alan Vaghti |
Assignee | Biju pm |
Created | 2011-10-14T17:17:16.000+0000 |
Updated | 2014-03-11T10:06:27.000+0000 |
Description
1) Create a new project and use the following app.js
var win = Ti.UI.createWindow({backgroundColor:'white'});
var b = Ti.UI.createButton({
title:'Log',
width:200,
height:40
});
b.addEventListener('click', function() {
Ti.API.info('a*b|c#d');
var foo = 'bar*baz|bat#durp';
Ti.API.info(foo);
Ti.API.trace("trace");
Ti.API.debug("Debug");
Ti.API.notice("Notice");
Ti.API.critical("Fatal");
Ti.API.warn("Warn");
Ti.API.error("Error");
// Coerce a warning from the system
var v = Ti.UI.createTableView();
v.deleteRow(0);
});
win.add(b);
win.open();
2) Launch app
Results: Application crashing. Android log shows: java.lang.IllegalStateException: Index out of range. Non-existant row at 0.
Expected results: The same application won't crash on an iOS device and the log output displays: [WARN] no rows found in table, ignoring delete
I tried this with the 2.1.2 SDK, and the app throws a Javascript error, but doesn't crash on the Java side.
add log instead of crash https://github.com/appcelerator/titanium_mobile/pull/4410
Verified the fix with: Appc-Studio: 3.2.0.201310181700 Sdk:3.2.0.v20131018154951 alloy:1.2.2 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.0.3 Device:Google Nexus 7(v4.3) Xcode: 5 Above Code used for verification. On Android and iOS app does not crash. But for iOS we get warning logs as: [WARN] : No rows found in table, ignoring delete For Android we get error logs as: E/TableViewProxy(25015): (main) [69421,101637] Unable to delete row. Index out of range. Non-existent row at 0. Closing the issue as fixed and application does not crash on both the platforms when using deleteRow for invalid index in tableView.