[TIMOB-1794] Android: Mixed type arrays assigned to proxies throw ClassCast exception
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:57:11.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.6.0 M06 |
Components | Android |
Labels | android, defect, release-1.6.0, rplist |
Reporter | Don Thorp |
Assignee | Bill Dawson |
Created | 2011-04-15T03:02:35.000+0000 |
Updated | 2011-04-17T01:57:11.000+0000 |
Description
See http://developer.appcelerator.com/helpdesk/view/42511">Helpdesk 42511
var win = Titanium.UI.createWindow();
var foo = ["foo", "bar",999];
// uncommenting this fixes it, because its no longer mixed type
// foo = ["foo", "bar","999"];
// this also works
// foo = [111,222,3333];
// exception doesnt happen until the array is assigned to a proxy object
win.foo = foo;
alert(win.foo);
win.open();
Wondering if this was a blocked issue until proxy assignment was completed.
Comments
- hal 2011-04-15
As discussed with Don, the following code also produces an exception in 1.4.3 (21Nov) but not in 1.5.X (17Dec).
var window = Titanium.UI.createWindow({ backgroundColor:'red' }); var view = Titanium.UI.createView({ backgroundColor:"blue" }); var x = [ 1,2,3,4,5,6 ]; view.myArray = x; window.add(view); window.open(); function isArray(obj) { if (obj.constructor.toString().indexOf("Array") == -1) return false; else return true; } Ti.API.info("x type isArray = "+isArray(x)); Ti.API.info("view.myArray[3] = "+view.myArray[3]); Ti.API.info("view.myArray type = "+typeof(view.myArray)); Ti.API.info("view.myArray type isArray = "+isArray(view.myArray)); //this causes the exception
The exception output can be found https://gist.github.com/751731">here
- Don Thorp 2011-04-15
Not sure why this is still open if it's in 1.5.1 please test and close if not valid.
- Marshall Culpepper 2011-04-15
(from [9e588f2c63514f614a78c32f37c14071a2a2d1a4]) the kroll invocation scope needs to pull from the current thread's ti context top level scope instead of the "start" which is essentially the
same as the "thisObject". added a kroll test, this fixes "constructor"
for Array and other types [#1794 state:fixed-in-qa]
https://github.com/appcelerator/titanium_mobile/commit/9e588f2c63514f614a78c32f37c14071a2a2d1a4"> https://github.com/appcelerator/titanium_mobile/commit/9e588f2c6351... - Opie Cyrus 2011-04-15
Verified crash is no longer occurring with test case from Hal.