{ "id": "95031", "key": "TIMOB-10015", "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": "13573", "description": "Sprint 2012-15 API", "name": "Sprint 2012-15 API", "archived": true, "released": true, "releaseDate": "2012-07-30" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-09-06T03:36:34.000+0000", "created": "2012-07-12T11:55:28.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "api", "module_view", "parity", "qe-review", "qe-testadded", "titanbeta" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13572", "description": "Release 2.1.1", "name": "Release 2.1.1", "archived": true, "released": true, "releaseDate": "2012-07-31" } ], "issuelinks": [ { "id": "18995", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "94016", "key": "TIMOB-9824", "fields": { "summary": "API: backgroundGradient \"colors\" default value", "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" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-07T05:52:59.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": "h4.Problem\r\nIf you leave off the *offset* property of elements in the *colors* array of a Gradient, the app crashes.\r\n\r\nh4.Expected behavior\r\nFirst element of the *colors* array should default to offset:0.0, and the second element of the *colors* array should default to offset:1.0, as this is a common case (full width or height gradient). Alternatively, a console error or \"red & white error screen\" should be produced when the *offset* property is not specified.\r\n\r\nh4.Actual bahavior\r\nA \"force close\" occurs with this crash error in the console log:\r\n{panel:title=console log}\r\n{code}\r\n[ERROR][TiApplication( 526)] (main) [104,104] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eCotton.GradientTest/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException; Titanium 2.1.0,2012/06/28 12:16,6e3cab6\r\n[ERROR][TiApplication( 526)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eCotton.GradientTest/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread.access$2300(ActivityThread.java:125)\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)\r\n[ERROR][TiApplication( 526)] \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[ERROR][TiApplication( 526)] \tat android.os.Looper.loop(Looper.java:123)\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread.main(ActivityThread.java:4627)\r\n[ERROR][TiApplication( 526)] \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR][TiApplication( 526)] \tat java.lang.reflect.Method.invoke(Method.java:521)\r\n[ERROR][TiApplication( 526)] \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\r\n[ERROR][TiApplication( 526)] \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\r\n[ERROR][TiApplication( 526)] \tat dalvik.system.NativeStart.main(Native Method)\r\n[ERROR][TiApplication( 526)] Caused by: java.lang.NullPointerException\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.util.TiConvert.toFloat(TiConvert.java:432)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.util.TiConvert.toFloat(TiConvert.java:462)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.view.TiGradientDrawable.loadColors(TiGradientDrawable.java:106)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.view.TiGradientDrawable.(TiGradientDrawable.java:83)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:824)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:594)\r\n[ERROR][TiApplication( 526)] \tat ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:884)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:441)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:433)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:411)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:527)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:204)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:111)\r\n[ERROR][TiApplication( 526)] \tat ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:93)\r\n[ERROR][TiApplication( 526)] \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:365)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:350)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:235)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:262)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:187)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:605)\r\n[ERROR][TiApplication( 526)] \tat ti.modules.titanium.ui.TiUIActivityWindow.windowCreated(TiUIActivityWindow.java:142)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:352)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:425)\r\n[ERROR][TiApplication( 526)] \tat org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22)\r\n[ERROR][TiApplication( 526)] \tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)\r\n[ERROR][TiApplication( 526)] \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)\r\n[ERROR][TiApplication( 526)] \t... 11 more\r\n[ERROR][AndroidRuntime( 526)] FATAL EXCEPTION: main\r\n[ERROR][AndroidRuntime( 526)] java.lang.RuntimeException: Unable to start activity ComponentInfo{com.eCotton.GradientTest/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread.access$2300(ActivityThread.java:125)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)\r\n[ERROR][AndroidRuntime( 526)] \tat android.os.Handler.dispatchMessage(Handler.java:99)\r\n[ERROR][AndroidRuntime( 526)] \tat android.os.Looper.loop(Looper.java:123)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread.main(ActivityThread.java:4627)\r\n[ERROR][AndroidRuntime( 526)] \tat java.lang.reflect.Method.invokeNative(Native Method)\r\n[ERROR][AndroidRuntime( 526)] \tat java.lang.reflect.Method.invoke(Method.java:521)\r\n[ERROR][AndroidRuntime( 526)] \tat com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)\r\n[ERROR][AndroidRuntime( 526)] \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)\r\n[ERROR][AndroidRuntime( 526)] \tat dalvik.system.NativeStart.main(Native Method)\r\n[ERROR][AndroidRuntime( 526)] Caused by: java.lang.NullPointerException\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.util.TiConvert.toFloat(TiConvert.java:432)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.util.TiConvert.toFloat(TiConvert.java:462)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.view.TiGradientDrawable.loadColors(TiGradientDrawable.java:106)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.view.TiGradientDrawable.(TiGradientDrawable.java:83)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.view.TiUIView.handleBackgroundImage(TiUIView.java:824)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.view.TiUIView.processProperties(TiUIView.java:594)\r\n[ERROR][AndroidRuntime( 526)] \tat ti.modules.titanium.ui.widget.TiView.processProperties(TiView.java:49)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:884)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:441)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:433)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:411)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:527)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiViewProxy.handleMessage(TiViewProxy.java:204)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.proxy.TiWindowProxy.handleMessage(TiWindowProxy.java:111)\r\n[ERROR][AndroidRuntime( 526)] \tat ti.modules.titanium.ui.ActivityWindowProxy.handleMessage(ActivityWindowProxy.java:93)\r\n[ERROR][AndroidRuntime( 526)] \tat android.os.Handler.dispatchMessage(Handler.java:95)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:365)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:350)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:235)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:262)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:187)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:605)\r\n[ERROR][AndroidRuntime( 526)] \tat ti.modules.titanium.ui.TiUIActivityWindow.windowCreated(TiUIActivityWindow.java:142)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:31)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:352)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:425)\r\n[ERROR][AndroidRuntime( 526)] \tat org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)\r\n[ERROR][AndroidRuntime( 526)] \tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)\r\n[ERROR][AndroidRuntime( 526)] \t... 11 more\r\n[WARN][ActivityManager( 60)] Force finishing activity com.eCotton.GradientTest/org.appcelerator.titanium.TiActivity\r\n{code}\r\n{panel}\r\n\r\nh4.Testcase\r\nRun the following code. A white-to-red vertical gradient box should appear at the top of the screen, but instead the app crashes.\r\n\r\nNow uncomment the offset code. The box appears with the correct gradient.\r\n\r\n{panel:title=app.js}\r\n{code}\r\nvar win1=Ti.UI.createWindow({\r\n layout:'vertical',\r\n backgroundColor:'gray',\r\n exitOnClose:true,\r\n navBarHidden:true\r\n });\r\n\r\nvar view1=Ti.UI.createView({\r\n height:100,\r\n width:100,\r\n backgroundGradient:{type:'linear',\r\n endPoint:{ x:0, y:'100%' },\r\n colors:[ {color:'white' /*, offset:0.0*/ },\r\n {color:'red' /*, offset:1.0*/ } ]}\r\n });\r\nwin1.add(view1);\r\n\r\nwin1.open();\r\n{code}\r\n{panel}\r\n", "attachment": [], "flagged": false, "summary": "Android: Gradient colors offset property, when unspecified, crashes app", "creator": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "subtasks": [], "reporter": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "environment": "- Android 2.2 emulator\r\n- Titanium Mobile SDK 2.1.0.GA\r\n- Titanium Studio 2.1.0.201206251749\r\n", "comment": { "comments": [ { "id": "208596", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The recommend way to create gradients that evenly distribute the colors\r\nis to just provide them in an array:\r\n\r\n{code:javascript}\r\nTi.UI.createView({\r\n backgroundGradient: {\r\n colors: ['white', 'red']\r\n }\r\n});\r\n{code}\r\n\r\nWe could provide the same functionality with the gradient color objects, but this becomes a bit more\r\ndifficult when you start mixing objects that have offsets and some that don't provide an offset.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-19T19:24:38.000+0000", "updated": "2012-07-19T19:26:50.000+0000" }, { "id": "208616", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Created [PR #2615|https://github.com/appcelerator/titanium_mobile/pull/2615] to resolve issue.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-19T20:17:07.000+0000", "updated": "2012-07-19T20:17:07.000+0000" }, { "id": "208618", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Ended up fixing the exception and matching iOS behavior by just discarding the offsets\r\nwhen the number of offsets does not match the number of colors.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-19T20:17:51.000+0000", "updated": "2012-07-19T20:17:51.000+0000" }, { "id": "208709", "author": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "body": "Josh, thanks for fixing this.\r\n\r\nI also didn't know that we could use the *colors**:* *['white', 'red']* syntax (I'm pretty sure that isn't in the online API docs), but I will start using it that way since it's cleaner.", "updateAuthor": { "name": "bitshftr", "key": "bitshftr", "displayName": "Shawn Lipscomb", "active": true, "timeZone": "America/New_York" }, "created": "2012-07-20T12:26:35.000+0000", "updated": "2012-07-20T12:26:35.000+0000" }, { "id": "214226", "author": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as fixed.\r\nTested and verified on:\r\nTitanium Studio, build: 2.1.1.201208091713\r\nTitanium SDK, build: 2.2.0.v20120810194112\r\nDevices: Nexus 7 tab (4.1), HTC Evo (4.0.3), Android Emulator (2.2)\r\n\r\nThe box appears with white-to-red vertical gradient.", "updateAuthor": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-13T16:49:56.000+0000", "updated": "2012-08-13T16:49:56.000+0000" }, { "id": "217794", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Reopening to update labels", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-09-06T03:36:02.000+0000", "updated": "2012-09-06T03:36:02.000+0000" }, { "id": "278609", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/4887", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-07T05:52:59.000+0000", "updated": "2013-11-07T05:52:59.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }