{ "id": "155872", "key": "AC-3398", "fields": { "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "8", "description": "", "name": "Needs more info" }, "resolutiondate": "2016-03-30T18:15:01.000+0000", "created": "2016-03-21T23:02:45.000+0000", "labels": [ "feedback" ], "versions": [ { "id": "17038", "name": "Appcelerator Studio 4.5.0", "archived": false, "released": false } ], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-30T18:15:01.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": [], "description": "h3. var user = Ti.App.Properties.getObject('user', accounts.createUser());\n\nThis is calling the default method even though property exists.\n", "attachment": [], "flagged": false, "summary": "Ti.App.Properties.getObject(property,default);", "creator": { "name": "sean.maclachlan", "key": "sean.maclachlan", "displayName": "Sean MacLachlan", "active": true, "timeZone": "America/Boise" }, "subtasks": [], "reporter": { "name": "sean.maclachlan", "key": "sean.maclachlan", "displayName": "Sean MacLachlan", "active": true, "timeZone": "America/Boise" }, "environment": null, "comment": { "comments": [ { "id": "380347", "author": { "name": "nsalahin", "key": "nsalahin", "displayName": "Nazmus Salahin", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\nI have tested the following code and got expected result. Default method is not called when property exists.\r\n*Code:*\r\n{code}\r\nvar defaultObject = 'Default';\r\nvar realObject = 'RealData';\r\nTi.App.Properties.setObject('testName', realObject);\r\nvar obj = Ti.App.Properties.getObject('testName', defaultFunction());\r\nTi.API.info(obj.toString());\r\n\r\nfunction defaultFunction() {\r\n\treturn defaultObject;\r\n}\r\n{code}\r\n*Console Output*\r\n{code}\r\n[INFO] : RealData\r\n{code}\r\n\r\n*Expected Result:*\r\nShows existing property rather than default property when exists .\r\n*Actual Result:*\r\n Existing property is shown rather than default property when exists.\r\n\r\n*Environment*:\r\n\r\n*Device info:* Nexux7 (android 6.0.1)\r\n*Node.js Version:* 0.12.7\r\n*npm Version:* 2.11.3\r\n*Titanium SDKs:* 5.2.0 and 5.1.2.GA\r\n*Java Development Kit Version:* 1.8.0_73\r\n*Titanium CLI Version:* 5.0.5\r\n*Appcelerator CLI Version:* 5.2.0\r\n*Appcelerator Studio:* 4.4.0.201511241829", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-03-22T10:02:06.000+0000", "updated": "2016-03-22T15:06:23.000+0000" }, { "id": "380367", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, \r\n\r\nCan you be a little more specific and explain what you are trying to do and what you are expecting to happen? Please provide a complete test code which you think demonstrate the unexpected behavior. Also please provide the complete steps to follow. Please provide your platform information. \r\n\r\nThanks. ", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-03-22T15:05:53.000+0000", "updated": "2016-03-22T15:05:53.000+0000" }, { "id": "380387", "author": { "name": "sean.maclachlan", "key": "sean.maclachlan", "displayName": "Sean MacLachlan", "active": true, "timeZone": "America/Boise" }, "body": "var accounts = {\r\n // Create a new anonymous user\r\n createUser: function createUser(){\r\n Ti.API.log(\"Creating new user\");\r\n accounts.clearCache();\r\n return require('user');\r\n },\r\n loadUser: function loadUser(){\r\n Ti.API.log('accounts.js : loadUser - user cache ' + JSON.stringify(Ti.App.Properties.getObject('user')));\r\n \r\n // This should work but create user is being called everytime, not just on undefined\r\n Alloy.Globals.user = Ti.App.Properties.getObject('user',accounts.createUser());\r\n },\r\n// Caches user changes and Uploads user settings to Orchestrate\r\n updateUser: function updateUser(){\r\n \r\n Ti.API.log(\"accounts.js : updateUser - cache \" + JSON.stringify(Alloy.Globals.user));\r\n Ti.App.Properties.setObject('user',Alloy.Globals.user);\r\n Ti.API.log('accounts.js : updateUser - user cache ' + JSON.stringify(Ti.App.Properties.getObject('user')));\r\n },\r\n};\r\nmodule.exports = accounts;\r\n\r\n\r\nMy logging shows that I'm calling loadUser and the user object isn't empty but it is calling createUser\r\n\r\n[INFO] : accounts.js : loadUser - user cache {\"location\":{\"useGPS\":false,\"city\":\"Boise\",\"distance\":\"20.0\",\"address\":\"Boise, ID, USA\",\"success\":true},\"userEmail\":\"\",status\":\"New\",\"accountType\":\"anonymous\"}\r\n\r\n[INFO] : Creating new user\r\n\r\n[DEBUG] : Loading: /Users/Sean/Library/Developer/CoreSimulator/Devices/5A3586F1-25C4-4F86-A169-0BB19D1FE96E/data/Containers/Bundle/Application/CF83D2E7-0E59-46DF-A617-3F5CA54B4A93/relevent.app/user.js, Resource: user_js\r\n\r\n[INFO] : accounts.js : loadUser - loaded {\"location\":{\"distance\":20,\"city\":\"Boise\",\"useGPS\":false,\"address\":\"Boise, ID\"},\"userEmail\":\"\",status\":\"Created\",\"accountType\":\"anonymous\"}\r\n\r\nSome of the logging and library methods were removed\r\n", "updateAuthor": { "name": "sean.maclachlan", "key": "sean.maclachlan", "displayName": "Sean MacLachlan", "active": true, "timeZone": "America/Boise" }, "created": "2016-03-22T17:41:34.000+0000", "updated": "2016-03-22T17:41:34.000+0000" }, { "id": "380544", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello,\r\n\r\nThe code you have provided has additional components and it isn't clear. Also, you haven't provided the complete steps. Please strip out any code from sample code that does not relate to the bug. Make it as minimalistic as you can. Only add code in order to show the issue, and keep out other things. Please provide a complete test code which you think demonstrate the unexpected behavior. Also please provide the complete steps to follow. Please provide your platform information. Follow the instruction http://docs.appcelerator.com/platform/latest/#!/guide/How_to_Submit_a_Bug_Report-section-29004732_HowtoSubmitaBugReport-CreatingaJIRAticket. \r\n\r\nThanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2016-03-23T19:02:36.000+0000", "updated": "2016-03-29T16:42:53.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }