{ "id": "149654", "key": "TIMOB-19211", "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": "16925", "description": "WatchKit Support--all going into 5.0 now", "name": "Release 5.0.0", "archived": true, "released": true, "releaseDate": "2015-09-16" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2015-08-03T10:08:40.000+0000", "created": "2015-07-13T18:13:47.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "textfield" ], "versions": [], "issuelinks": [], "assignee": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-08-27T20:50:27.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h6.Issue Description\r\nTapping \"Undo\" button will result in application crashing. \r\n\r\nh6.Steps to Replicate\r\nA Ti.UI.Textfield that will only allow numeric characters (0 to 9 and .) Textfiled has keyboard type of Ti.UI.KEYBOARD_DECIMAL_PAD. \r\n1. Started the application. \r\n2. Tapping on numbers will update the textfield and tapping on undo will clear the textfield (This is expected behaviour). \r\n3. Tapping on other characters present on the keyboard that are not numeric and then tapping on the undo button will result in application crashing. \r\n\r\nh6.Test Case\r\n{code}\r\nvar changeCallback = function(e) {\r\n e.source.value = e.source.value.replace(new RegExp(\"[^0-9.]\"), \"\");\r\n};\r\n\r\nvar window = Ti.UI.createWindow({\r\n layout : 'vertical',\r\n backgroundColor : 'white',\r\n height : Ti.UI.FILL,\r\n width : Ti.UI.FILL\r\n});\r\n\r\nvar sampleTest = Ti.UI.createTextField({\r\n height : 40,\r\n width : Titanium.UI.FILL,\r\n keyboardType : Ti.UI.KEYBOARD_DECIMAL_PAD,\r\n top : 50,\r\n left : 50,\r\n borderWidth : 1,\r\n borderColor : \"blue\",\r\n maxLength : 53,\r\n hintText : 'Here goes the sample text',\r\n value : '',\r\n});\r\n\r\nsampleTest.addEventListener(\"change\", changeCallback);\r\n\r\nwindow.add(sampleTest);\r\n\r\nwindow.open(); \r\n{code}\r\n\r\nh6.Crash logs\r\n{code}\r\n-- Start application log -----------------------------------------------------\r\n[INFO] dropDown/1.0 (4.2.0.afcd782)\r\n[ERROR] The application has crashed with an uncaught exception 'NSRangeException'.\r\n[ERROR] Reason:\r\n[ERROR] -[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds\r\n[ERROR] Stack trace:\r\n[ERROR] \r\n[ERROR] 0 CoreFoundation 0x0000000185d3a530 + 132\r\n[ERROR] 1 libobjc.A.dylib 0x0000000196cf80e4 objc_exception_throw + 60\r\n[ERROR] 2 CoreFoundation 0x0000000185d3a470 + 0\r\n[ERROR] 3 CoreFoundation 0x0000000185ce4ed0 + 256\r\n[ERROR] 4 Foundation 0x0000000186c2dec4 + 160\r\n[ERROR] 5 dropDown 0x000000010014cf30 dropDown + 429872\r\n[ERROR] 6 UIKit 0x000000018ac9beec + 112\r\n[ERROR] 7 UIKit 0x000000018aca1760 + 108\r\n[ERROR] 8 UIKit 0x000000018acfcae8 + 268\r\n[ERROR] 9 Foundation 0x0000000186c75960 + 308\r\n[ERROR] 10 Foundation 0x0000000186c74584 + 468\r\n[ERROR] 11 UIKit 0x000000018a712030 + 640\r\n[ERROR] 12 UIKit 0x000000018a711ca0 + 644\r\n[ERROR] 13 UIKit 0x000000018a705db4 + 3784\r\n[ERROR] 14 UIKit 0x000000018a704d48 + 1428\r\n[ERROR] 15 UIKit 0x000000018a7046d0 + 252\r\n[ERROR] 16 UIKit 0x000000018a570630 + 388\r\n[ERROR] 17 UIKit 0x000000018a700e3c + 272\r\n[ERROR] 18 UIKit 0x000000018a700bf4 + 392\r\n[ERROR] 19 UIKit 0x000000018a57c03c + 700\r\n[ERROR] 20 UIKit 0x000000018a575590 + 684\r\n[ERROR] 21 UIKit 0x000000018a548e60 + 264\r\n[ERROR] 22 UIKit 0x000000018a7e846c + 15220\r\n[ERROR] 23 UIKit 0x000000018a5473d0 + 1716\r\n[ERROR] 24 CoreFoundation 0x0000000185cf2d34 + 24\r\n[ERROR] 25 CoreFoundation 0x0000000185cf1fd8 + 264\r\n[ERROR] 26 CoreFoundation 0x0000000185cf0088 + 712\r\n[ERROR] 27 CoreFoundation 0x0000000185c1d1f4 CFRunLoopRunSpecific + 396\r\n[ERROR] 28 GraphicsServices 0x000000018ef3f6fc GSEventRunModal + 168\r\n[ERROR] 29 UIKit 0x000000018a5ae10c UIApplicationMain + 1488\r\n[ERROR] 30 dropDown 0x00000001000ebbec dropDown + 31724\r\n[ERROR] 31 libdyld.dylib 0x0000000197376a08 + 4\r\n[ERROR] *** Terminating app due to uncaught exception 'NSRangeException', reason: '-[__NSCFString replaceCharactersInRange:withString:]: Range or index out of bounds'\r\n[ERROR] *** First throw call stack:\r\n[ERROR] (0x185d3a530 0x196cf80e4 0x185d3a470 0x185ce4ed0 0x186c2dec4 0x10014cf30 0x18ac9beec 0x18aca1760 0x18acfcae8 0x186c75960 0x186c74584 0x18a712030 0x18a711ca0 0x18a705db4 0x18a704d48 0x18a7046d0 0x18a570630 0x18a700e3c 0x18a700bf4 0x18a57c03c 0x18a575590 0x18a548e60 0x18a7e846c 0x18a5473d0 0x185cf2d34 0x185cf1fd8 0x185cf0088 0x185c1d1f4 0x18ef3f6fc 0x18a5ae10c 0x1000ebbec 0x197376a08)\r\n{code}", "attachment": [], "flagged": false, "summary": "iOS: Tapping \"undo\" will get a range or index out of bounds on TiUITextField", "creator": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "egomez", "key": "egomez", "displayName": "Eduardo Gomez", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 4.1.0.GA & CI Master 4.2.0.v20150710092422 \r\niOS 8 (iPad Tablet)", "closedSprints": [ { "id": 451, "state": "closed", "name": "2015 Sprint 16 SDK", "startDate": "2015-08-01T00:30:05.052Z", "endDate": "2015-08-15T00:30:00.000Z", "completeDate": "2015-08-17T05:55:00.386Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "357627", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[link|http://stackoverflow.com/questions/433337/set-the-maximum-character-length-of-a-uitextfield] explaining crash.\r\nLikely have a solution to prevent crash, but will set 'undo' to *not* clear the textfield, which should be reasonable considering that 'undo' isn't really a designated function for any keyboard numerical pad.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-07-14T07:20:08.000+0000", "updated": "2015-07-14T07:20:08.000+0000" }, { "id": "357726", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR here: https://github.com/appcelerator/titanium_mobile/pull/6975\r\nOnly merge after 4.2.0", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-07-15T01:42:08.000+0000", "updated": "2015-07-15T01:42:44.000+0000" }, { "id": "358841", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "CR passed and merged to master.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-08-03T10:08:23.000+0000", "updated": "2015-08-03T10:08:23.000+0000" }, { "id": "361497", "author": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed, using:\r\n\r\nMacOS 10.11 (15A263e)\r\nStudio 5.0.0.201508271032\r\nTi SDK 5.0.0.v20150827102632\r\nAppc NPM 4.2.0-1\r\nAppc CLI 5.0.0-24\r\nTi CLI 4.1.5\r\nAlloy 1.7.5\r\nArrow 1.2.48\r\nXcode 7.0 (7A192o)\r\nNode v0.10.37\r\nJava 1.7.0_45\r\npreproduction\r\n\r\nI do not encounter a crash when removing non-numerical characters.", "updateAuthor": { "name": "ewieber", "key": "ewieber", "displayName": "Eric Wieber", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-08-27T20:50:27.000+0000", "updated": "2015-08-27T20:50:27.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }