{ "id": "124876", "key": "TIMOB-16207", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-03-06T21:51:35.000+0000", "created": "2014-01-16T16:43:30.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_android", "parity", "qe-testadded" ], "versions": [], "issuelinks": [ { "id": "34320", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "122777", "key": "ALOY-894", "fields": { "summary": "Android proxies throwing ClassCastException on non string attributes", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "44222", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "141774", "key": "TIMOB-18254", "fields": { "summary": "Using wrong value type should give informative error instead of crash (on Android)", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "updated": "2014-12-17T16:03:04.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Originally reported as an Alloy issue, this is a platform issue. Setting a property to a string that expects a boolean will work on iOS but throw an exception on Android.\r\n\r\nTest case: returnKeyEnabled expects boolean, drop the following into a new classic project, build for Android, tap the text field then with or without entering text in the field, tap the Done (return) button to cause the crash.\r\n\r\nApp works as-is on iOS (7.0 simulator)\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({ \r\n backgroundColor:'#fff',\r\n layout: 'vertical'\r\n});\r\n\r\nvar txt = Ti.UI.createTextField({\r\n top: 50, width: Ti.UI.FILL, \r\n color: 'black',\r\n borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,\r\n enableReturnKey: 'true' // change to true to \"fix\"\r\n});\r\n\r\nwin.add(txt);\r\n\r\n\r\nwin.open();\r\n{code}\r\n\r\n{code}\r\n[ERROR] TiApplication: (main) [12383,12383] Sending event: exception on thread: main msg:java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean; Titanium 3.2.0,2013/12/20 10:57,d9182d6\r\n[ERROR] TiApplication: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean\r\n[ERROR] TiApplication: \tat ti.modules.titanium.ui.widget.TiUIText.onEditorAction(TiUIText.java:389)\r\n[ERROR] TiApplication: \tat android.widget.TextView.onEditorAction(TextView.java:4117)\r\n[ERROR] TiApplication: \tat com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:138)\r\n[ERROR] TiApplication: \tat com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:297)\r\n[ERROR] TiApplication: \tat com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:77)\r\n[ERROR] TiApplication: \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[ERROR] TiApplication: \tat android.os.Looper.loop(Looper.java:137)\r\n[ERROR] TiApplication: \tat android.app.ActivityThread.main(ActivityThread.java:5041)\r\n[ERROR] TiApplication: \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR] TiApplication: \tat java.lang.reflect.Method.invoke(Method.java:511)\r\n[ERROR] TiApplication: \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)\r\n[ERROR] TiApplication: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)\r\n[ERROR] TiApplication: \tat dalvik.system.NativeStart.main(Native Method)\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Setting a property that expect a boolean to a string throws ClassCastException", "creator": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "environment": "Ti 3.2.0.GA, tested on Genymotion, Galaxy Nexus 4.2.2", "comment": { "comments": [ { "id": "288453", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Originally reported as Alloy issue, but this is underlying platform behavior", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-16T16:44:54.000+0000", "updated": "2014-01-16T16:44:54.000+0000" }, { "id": "288807", "author": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "body": "PR:-\r\nhttps://github.com/appcelerator/titanium_mobile/pull/5238", "updateAuthor": { "name": "bijuexalture", "key": "bijuexalture", "displayName": "Biju pm", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-01-20T08:41:08.000+0000", "updated": "2014-01-20T08:41:08.000+0000" }, { "id": "302140", "author": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the issue using the environment :\r\n\r\nAppc-Studio:3.2.3.201404162038\r\nsdk:3.3.0.v20140417173316\r\nacs:1.0.14\r\nalloy:1.3.1\r\nnpm:1.3.2\r\ntitanium:3.2.3-beta2\r\ntitanium-code-processor:1.1.1-beta1\r\nxcode:5.1.1\r\nDevice:Nexus5(v4.4.2),Iphone5(v7.1)\r\n\r\nobserved that it does not give the exception message if we provide string value in the property \"enableReturnKey\" for iOS as well as Android.\r\n\r\nBut,According to documentation, the property \"enableReturnKey\" accept boolean value only. \r\nDocumentation made me think? why this property \"enableReturnKey\" takes the string value and typecast internally. \r\nInstead of this exception should be handled gracefully and give proper error message if we provide value other than boolean.", "updateAuthor": { "name": "pagarwal", "key": "pagarwal", "displayName": "Priya Agarwal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-04-23T06:07:04.000+0000", "updated": "2014-04-23T06:07:04.000+0000" }, { "id": "302185", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "[~pagarwal] Since iOS does this conversion automatically internally, the request was to match functionality on the Android site to ease the burden on internal and external developers. For example:\r\n\r\n* - Values entered in the XML or TSS are treated as strings unless Alloy adds special handling for them (to transform them to booleans). Adding these special cases increases our development and maintenance costs.\r\n* - The same would be true for any data retrieved from a web service that returns XML -- the developer would need to parse the data and cast values on Android, but not on iOS. \r\n* - I have frequently encountered this issue when setting a TextField's value to a numeric value -- on iOS, I can set {{textfield.text = 20}} but on Android I have to do {{textfield.text = String(20)}}. ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-04-23T14:21:12.000+0000", "updated": "2014-04-23T14:21:12.000+0000" }, { "id": "303579", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix. Setting a property that expect a boolean to a string does not throws ClassCastException error.\r\n\r\nClosing.\r\n\r\nEnvironment:\r\nAppc Studio : 3.2.3.201404181520\r\nTi SDK : 3.3.0.v20140502133323\r\nMac OSX : 10.8.5\r\nAlloy : 1.3.1\t\r\nCLI - 3.2.3\r\nNexus 5 - android 4.4.2", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-05-06T00:22:31.000+0000", "updated": "2014-05-06T00:22:31.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }