[TIMOB-10255] Blackberry: Titanium.App.Properties - Cannot convert types.
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-02-10T07:17:25.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.1.0, 2013 Sprint 03 BB, 2013 Sprint 03 |
Components | BlackBerry |
Labels | n/a |
Reporter | Hayk Zakaryan |
Assignee | Josh Roesslein |
Created | 2012-07-31T07:06:20.000+0000 |
Updated | 2017-03-08T18:05:03.000+0000 |
Description
If some Int property is set like Titanium.App.Properties.setInt('Int',10) and than further trying to get it like this
Titanium.App.Properties.getString('Int') (with getString()) It crashes - code which is below is not working.
When trying to get as Titanium.App.Properties.getInt('Int') - it is fine
The same is for Titanium.App.Properties.getString('Bool') and Titanium.App.Properties.getString('Double')- if you have set 'Bool' as setBool() and 'Double' as setDouble('Double',10.6);
Also for setXXX method Titanium.App.Properties.setString('String',null) is crashing
In the logs found this message - 'Invalid argument: expected String'
This was tested on Blackberry emulator.
KitchenSink -> Platform Tab->Properties API.
File - Resources\ui\common\platform\properties.js (Lines 84-86, 106)
Also should fix Ti.App, etc to inherit from TiProxy instead of TiObject and uncomment the stuff in KitchenSink.
Getters should try to convert the value if possible
{quote} Also for setXXX method Titanium.App.Properties.setString('String',null) is crashing In the logs found this message - 'Invalid argument: expected String' {quote} This test case doesn't seem valid as null is not a String so the raised exception seems to be right.
Tested Titanium.App.Properties.setString('String',null) on Android and correspondingly Titanium.App.Properties.getString('String'). Both of them worked without raising exception. Getter returned null.
Also tested on Android: Titanium.App.Properties.setInt('int',15); and tried to get with getDouble() Titanium.App.Properties.getDouble('int'); Worked normally and returned 15.
Created pull request [#23](https://github.com/appcelerator/titanium_mobile_blackberry/pull/23) to resolve issue.
Closing ticket as resolved.