Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-5756] Android: TableView deleteRow with invalid index crashes the application instead of warning

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-06-30T00:26:31.000+0000
Affected Version/sRelease 1.8.0
Fix Version/s2013 Sprint 14, 2013 Sprint 14 API, Release 3.2.0
ComponentsAndroid
Labelsparity, qe-testadded, tbs-2.1.0
ReporterAlan Vaghti
AssigneeBiju pm
Created2011-10-14T17:17:16.000+0000
Updated2014-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

Comments

  1. Karl Rowley 2012-09-26

    I tried this with the 2.1.2 SDK, and the app throws a Javascript error, but doesn't crash on the Java side.
  2. Biju pm 2013-06-24

    add log instead of crash https://github.com/appcelerator/titanium_mobile/pull/4410
  3. Priya Agarwal 2013-10-21

    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.

JSON Source