{ "id": "85797", "key": "TIMOB-7497", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-09T16:45:40.000+0000", "created": "2012-02-01T07:21:45.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "parity" ], "versions": [ { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-09T16:45:40.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": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "h2. Problem\r\n\r\nWhile valid integers stored in platform properties using the [Titanium.App.Properties.setInt|http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.App.Properties.setInt-method.html] method behave correctly, those that exceed the value are returned differently on iOS and Android.\r\n\r\nNote that I have returned the stored values using both {{getInt()}} and {{getDouble}}, out of interest, which causes an exception on Android but not on iOS. Ideally, this behavior would also be consistent.\r\n\r\nh2. Test case\r\n\r\n{code:lang=javascript|title=app.js}\r\nTi.App.Properties.setInt(\"NegativeNumberLowInt\", -2147483647);\r\nTi.API.info(\"****** NegativeNumberLowInt -2147483647 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberLowInt: \" + Ti.App.Properties.getInt(\"NegativeNumberLowInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberMediumInt\", -2147483648);\r\nTi.API.info(\"****** NegativeNumberMediumInt -2147483648 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberMediumInt: \" + Ti.App.Properties.getInt(\"NegativeNumberMediumInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberHigherInt\", -2147483649);\r\nTi.API.info(\"****** NegativeNumberHigherInt -2147483649 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberHigherInt: \" + Ti.App.Properties.getInt(\"NegativeNumberHigherInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberHighestInt\", -1325269931753);\r\nTi.API.info(\"****** NegativeNumberHighestInt -1325269931753 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberHighestInt: \" + Ti.App.Properties.getInt(\"NegativeNumberHighestInt\"));\r\n\r\nTi.API.info(\"----------------------------------\");\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberLowInt\", 2147483646);\r\nTi.API.info(\"****** PositiveNumberLowInt 2147483646 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberLowInt: \" + Ti.App.Properties.getInt(\"PositiveNumberLowInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberMediumInt\", 2147483647);\r\nTi.API.info(\"****** PositiveNumberMediumInt 2147483647 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberMediumInt: \" + Ti.App.Properties.getInt(\"PositiveNumberMediumInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberHigherInt\", 2147483648);\r\nTi.API.info(\"****** PositiveNumberHigherInt 2147483648 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberHigherInt: \" + Ti.App.Properties.getInt(\"PositiveNumberHigherInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberHighestInt\", 1325269931753);\r\nTi.API.info(\"****** PositiveNumberHighestInt 1325269931753 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberHighestInt: \" + Ti.App.Properties.getInt(\"PositiveNumberHighestInt\"));\r\n\r\nTi.API.info(\"----------------------------------\");\r\nTi.API.info(\"----------------------------------\");\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberLowInt\", -2147483647);\r\nTi.API.info(\"****** NegativeNumberLowInt -2147483647 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberLowInt: \" + Ti.App.Properties.getDouble(\"NegativeNumberLowInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberMediumInt\", -2147483648);\r\nTi.API.info(\"****** NegativeNumberMediumInt -2147483648 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberMediumInt: \" + Ti.App.Properties.getDouble(\"NegativeNumberMediumInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberHigherInt\", -2147483649);\r\nTi.API.info(\"****** NegativeNumberHigherInt -2147483649 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberHigherInt: \" + Ti.App.Properties.getDouble(\"NegativeNumberHigherInt\"));\r\n\r\nTi.App.Properties.setInt(\"NegativeNumberHighestInt\", -1325269931753);\r\nTi.API.info(\"****** NegativeNumberHighestInt -1325269931753 Saved ******\");\r\nTi.API.info(\"****** NegativeNumberHighestInt: \" + Ti.App.Properties.getDouble(\"NegativeNumberHighestInt\"));\r\n\r\nTi.API.info(\"----------------------------------\");\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberLowInt\", 2147483646);\r\nTi.API.info(\"****** PositiveNumberLowInt 2147483646 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberLowInt: \" + Ti.App.Properties.getDouble(\"PositiveNumberLowInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberMediumInt\", 2147483647);\r\nTi.API.info(\"****** PositiveNumberMediumInt 2147483647 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberMediumInt: \" + Ti.App.Properties.getDouble(\"PositiveNumberMediumInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberHigherInt\", 2147483648);\r\nTi.API.info(\"****** PositiveNumberHigherInt 2147483648 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberHigherInt: \" + Ti.App.Properties.getDouble(\"PositiveNumberHigherInt\"));\r\n\r\nTi.App.Properties.setInt(\"PositiveNumberHighestInt\", 1325269931753);\r\nTi.API.info(\"****** PositiveNumberHighestInt 1325269931753 Saved ******\");\r\nTi.API.info(\"****** PositiveNumberHighestInt: \" + Ti.App.Properties.getDouble(\"PositiveNumberHighestInt\"));\r\n{code}\r\n\r\nh2. Logs\r\n\r\nh3. Android\r\n\r\nOn Android:\r\n* negative numbers that are below the max limit are stored as {{-2147483648}}\r\n* positive numbers that are above the max limit are stored as {{2147483647}}\r\n\r\n\r\n\r\n{code:lang=none|title=Android Console}\r\nI/TiApplication( 990): (main) [235,235] Titanium 1.8.1 (2012/01/27 17:31 a24502a)\r\nD/dalvikvm( 990): GC_FOR_MALLOC freed 3623 objects / 319608 bytes in 61ms\r\nD/TiFastDev( 990): (main) [175,410] Enabling Fastdev on port 52214\r\nD/TiFastDev( 990): (main) [9,419] sent tokens successfully\r\nD/TiFastDev( 990): (main) [1,420] Fastdev session handshake succesful.\r\nI/TiApplication( 990): (main) [7,427] Titanium Javascript runtime: v8\r\nD/dalvikvm( 990): Trying to load lib /data/data/com.appcelerator.testing11/lib/libstlport_shared.so 0x44e7e580\r\nD/dalvikvm( 990): Added shared lib /data/data/com.appcelerator.testing11/lib/libstlport_shared.so 0x44e7e580\r\nD/dalvikvm( 990): No JNI_OnLoad found in /data/data/com.appcelerator.testing11/lib/libstlport_shared.so 0x44e7e580, skipping init\r\nD/dalvikvm( 990): Trying to load lib /data/data/com.appcelerator.testing11/lib/libkroll-v8.so 0x44e7e580\r\nW/TiApplication( 990): (main) [62,489] activity stack is emtpy, unable to get current activity\r\nI/TiRootActivity( 990): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null\r\nD/dalvikvm( 990): Added shared lib /data/data/com.appcelerator.testing11/lib/libkroll-v8.so 0x44e7e580\r\nW/TiApplication( 990): (main) [119,119] activity stack is emtpy, unable to get current activity\r\nW/TiApplication( 990): (main) [0,119] activity stack is emtpy, unable to get current activity\r\nW/TiApplication( 990): (main) [1,120] activity stack is emtpy, unable to get current activity\r\nE/TiApplication( 990): (KrollRuntimeThread) [1250,1370] APP PROXY: ti.modules.titanium.app.AppModule@44ec9198\r\nD/TiAssetHelper( 990): Fetching \"app.js\" with Fastdev...\r\nD/dalvikvm( 990): GC_FOR_MALLOC freed 3137 objects / 418352 bytes in 51ms\r\nI/TiAPI ( 990): ****** NegativeNumberLowInt -2147483647 Saved ******\r\nI/TiAPI ( 990): ****** NegativeNumberLowInt: -2147483647\r\nI/TiAPI ( 990): ****** NegativeNumberMediumInt -2147483648 Saved ******\r\nI/TiAPI ( 990): ****** NegativeNumberMediumInt: -2147483648\r\nI/TiAPI ( 990): ****** NegativeNumberHigherInt -2147483649 Saved ******\r\nI/TiAPI ( 990): ****** NegativeNumberHigherInt: -2147483648\r\nI/TiAPI ( 990): ****** NegativeNumberHighestInt -1325269931753 Saved ******\r\nI/TiAPI ( 990): ****** NegativeNumberHighestInt: -2147483648\r\nI/TiAPI ( 990): ----------------------------------\r\nI/TiAPI ( 990): ****** PositiveNumberLowInt 2147483646 Saved ******\r\nI/TiAPI ( 990): ****** PositiveNumberLowInt: 2147483646\r\nI/TiAPI ( 990): ****** PositiveNumberMediumInt 2147483647 Saved ******\r\nI/TiAPI ( 990): ****** PositiveNumberMediumInt: 2147483647\r\nI/TiAPI ( 990): ****** PositiveNumberHigherInt 2147483648 Saved ******\r\nI/TiAPI ( 990): ****** PositiveNumberHigherInt: 2147483647\r\nI/TiAPI ( 990): ****** PositiveNumberHighestInt 1325269931753 Saved ******\r\nI/TiAPI ( 990): ****** PositiveNumberHighestInt: 2147483647\r\nI/TiAPI ( 990): ----------------------------------\r\nI/TiAPI ( 990): ----------------------------------\r\n\r\n// using getDouble()\r\n\r\nI/TiAPI ( 990): ****** NegativeNumberLowInt -2147483647 Saved ******\r\nE/TiJSError( 990): (main) [567,1937] ----- Titanium Javascript Runtime Error -----\r\nE/TiJSError( 990): (main) [1,1938] - In ti:/properties.js:18,20\r\nE/TiJSError( 990): (main) [0,1938] - Message: Uncaught Error: java.lang.Integer\r\nE/TiJSError( 990): (main) [0,1938] - Source: \t\t\treturn delegate.call(Properties, key);\r\nE/V8Exception( 990): Exception occurred at ti:/properties.js:18: Uncaught Error: java.lang.Integer\r\nI/TiRootActivity( 990): (main) [0,0] checkpoint, on root activity resume. activity = com.appcelerator.testing11.Testing11Activity@44ee0098\r\nI/ActivityManager( 60): Displayed activity com.appcelerator.testing11/.Testing11Activity: 4564 ms (total 4564 ms)\r\nD/dalvikvm( 116): GC_EXPLICIT freed 135 objects / 7064 bytes in 50ms\r\n{code}\r\n\r\nh3. iOS\r\n\r\nOn iOS:\r\n* negative numbers that are below the max limit are stored as {{2147483647}}, very large negatives stored as {{1874962711}}\r\n* positive numbers that are above the max limit are stored as {{-2147483648}}, very large positives stored as {{-1874962711}}\r\n\r\n{code:lang=none|title=iOS Console}\r\n[INFO] Application started\r\n[INFO] testing11/1.0 (1.8.1.a24502a)\r\n[INFO] ****** NegativeNumberLowInt -2147483647 Saved ******\r\n[INFO] ****** NegativeNumberLowInt: -2147483647\r\n[INFO] ****** NegativeNumberMediumInt -2147483648 Saved ******\r\n[INFO] ****** NegativeNumberMediumInt: -2147483648\r\n[INFO] ****** NegativeNumberHigherInt -2147483649 Saved ******\r\n[INFO] ****** NegativeNumberHigherInt: 2147483647\r\n[INFO] ****** NegativeNumberHighestInt -1325269931753 Saved ******\r\n[INFO] ****** NegativeNumberHighestInt: 1874962711\r\n[INFO] ----------------------------------\r\n[INFO] ****** PositiveNumberLowInt 2147483646 Saved ******\r\n[INFO] ****** PositiveNumberLowInt: 2147483646\r\n[INFO] ****** PositiveNumberMediumInt 2147483647 Saved ******\r\n[INFO] ****** PositiveNumberMediumInt: 2147483647\r\n[INFO] ****** PositiveNumberHigherInt 2147483648 Saved ******\r\n[INFO] ****** PositiveNumberHigherInt: -2147483648\r\n[INFO] ****** PositiveNumberHighestInt 1325269931753 Saved ******\r\n[INFO] ****** PositiveNumberHighestInt: -1874962711\r\n[INFO] ----------------------------------\r\n[INFO] ----------------------------------\r\n\r\n// using getDouble()\r\n\r\n[INFO] ****** NegativeNumberLowInt -2147483647 Saved ******\r\n[INFO] ****** NegativeNumberLowInt: -2147483647\r\n[INFO] ****** NegativeNumberMediumInt -2147483648 Saved ******\r\n[INFO] ****** NegativeNumberMediumInt: -2147483648\r\n[INFO] ****** NegativeNumberHigherInt -2147483649 Saved ******\r\n[INFO] ****** NegativeNumberHigherInt: 2147483647\r\n[INFO] ****** NegativeNumberHighestInt -1325269931753 Saved ******\r\n[INFO] ****** NegativeNumberHighestInt: 1874962711\r\n[INFO] ----------------------------------\r\n[INFO] ****** PositiveNumberLowInt 2147483646 Saved ******\r\n[INFO] ****** PositiveNumberLowInt: 2147483646\r\n[INFO] ****** PositiveNumberMediumInt 2147483647 Saved ******\r\n[INFO] ****** PositiveNumberMediumInt: 2147483647\r\n[INFO] ****** PositiveNumberHigherInt 2147483648 Saved ******\r\n[INFO] ****** PositiveNumberHigherInt: -2147483648\r\n[INFO] ****** PositiveNumberHighestInt 1325269931753 Saved ******\r\n[INFO] ****** PositiveNumberHighestInt: -1874962711\r\n{code}\r\n\r\nh2. Related Info\r\n\r\n[Java's Primitive Data Types|http://ibiblio.org/java/course/week2/02.html]", "attachment": [], "flagged": false, "summary": "Ti.API: Properties - inconsistencies when storing integers using setInt method that exceed datatype range", "creator": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "environment": "* Titanium 1.8.1\r\n* v8\r\n* Android 2.2\r\n* Emulator\r\n* iOS5\r\n* iPhone Simulator", "comment": { "comments": [ { "id": "421631", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket due to time passed, any problems please open a new ticket.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-06-09T16:45:40.000+0000", "updated": "2017-06-09T16:45:40.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }