Problem
Setting
Ti.UI.orientation
on Android results in a crash.
Expected behavior would be that it prints a depreciation warning and keeps working (and eventually does nothing at all, when it's totally removed).
Note: This works on iOS and has the intended effect.
Test case
Ti.UI.orientation = Ti.UI.PORTRAIT;
Logs
12-30 11:03:40.523: E/TiApplication(26911): (main) [312,1144] APP PROXY: [Ti.App]
12-30 11:03:40.648: E/KrollReflectionProperty(26911): (kroll$1: app://app.js) [37,1248] Exception getting/setting property: orientation
12-30 11:03:40.648: E/KrollReflectionProperty(26911): java.lang.RuntimeException: java.lang.NullPointerException
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.util.AsyncResult.getResult(AsyncResult.java:51)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollDynamicProperty.safeInvoke(KrollDynamicProperty.java:74)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollDynamicProperty.set(KrollDynamicProperty.java:101)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollProxy.setDynamicProperty(KrollProxy.java:259)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollProxy.set(KrollProxy.java:201)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollObject.put(KrollObject.java:102)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:2126)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1623)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1613)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.example.app_name_here.js.app._c_script_0(Unknown Source)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.example.app_name_here.js.app.call(Unknown Source)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.example.app_name_here.js.app.call(Unknown Source)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.example.app_name_here.js.app.exec(Unknown Source)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiScriptRunner.executeScript(TiScriptRunner.java:59)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiScriptRunner.main(TiScriptRunner.java:40)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.example.app_name_here.js.app.main(Unknown Source)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at java.lang.reflect.Method.invoke(Method.java:507)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiScriptRunner.runScript(TiScriptRunner.java:103)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollContext.runCompiledScript(KrollContext.java:314)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:380)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:218)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:223)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.os.Handler.dispatchMessage(Handler.java:95)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.os.Looper.loop(Looper.java:130)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): Caused by: java.lang.NullPointerException
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at ti.modules.titanium.ui.UIModule.setOrientation(UIModule.java:155)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at ti.modules.titanium.ui.UIModuleBindingGen$34.dynamicSet(UIModuleBindingGen.java:689)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.kroll.KrollDynamicProperty$1.run(KrollDynamicProperty.java:66)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:219)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.os.Handler.dispatchMessage(Handler.java:95)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiMessageQueue.sendBlockingMessage(TiMessageQueue.java:196)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollContext.evalFile(KrollContext.java:284)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.kroll.KrollBridge.evalFile(KrollBridge.java:130)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:189)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:209)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:73)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:125)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:299)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:115)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:38)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-30 11:03:40.648: E/KrollReflectionProperty(26911): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-30 11:03:40.648: E/KrollReflectionProperty(26911):
12-30 11:03:40.734: E/TiScriptRunner(26911): (kroll$1: app://app.js) [57,1305] Javascript Exception: Wrapped java.lang.RuntimeException: java.lang.NullPointerException
12-30 11:03:40.734: E/TiScriptRunner(26911): org.mozilla.javascript.WrappedException: Wrapped java.lang.RuntimeException: java.lang.NullPointerException
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.Context.throwAsScriptRuntimeEx(Context.java:1781)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollDynamicProperty.safeInvoke(KrollDynamicProperty.java:79)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollDynamicProperty.set(KrollDynamicProperty.java:101)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollProxy.setDynamicProperty(KrollProxy.java:259)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollProxy.set(KrollProxy.java:201)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollObject.put(KrollObject.java:102)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.ScriptableObject.putProperty(ScriptableObject.java:2126)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1623)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1613)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.example.app_name_here.js.app._c_script_0(Unknown Source)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.example.app_name_here.js.app.call(Unknown Source)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:426)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3161)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.example.app_name_here.js.app.call(Unknown Source)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.example.app_name_here.js.app.exec(Unknown Source)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiScriptRunner.executeScript(TiScriptRunner.java:59)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiScriptRunner.main(TiScriptRunner.java:40)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.example.app_name_here.js.app.main(Unknown Source)
12-30 11:03:40.734: E/TiScriptRunner(26911): at java.lang.reflect.Method.invokeNative(Native Method)
12-30 11:03:40.734: E/TiScriptRunner(26911): at java.lang.reflect.Method.invoke(Method.java:507)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiScriptRunner.runScript(TiScriptRunner.java:103)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollContext.runCompiledScript(KrollContext.java:314)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollContext.handleEvalFile(KrollContext.java:380)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollContext.handleMessage(KrollContext.java:218)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:223)
12-30 11:03:40.734: E/TiScriptRunner(26911): at android.os.Handler.dispatchMessage(Handler.java:95)
12-30 11:03:40.734: E/TiScriptRunner(26911): at android.os.Looper.loop(Looper.java:130)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollHandlerThread.run(KrollHandlerThread.java:86)
12-30 11:03:40.734: E/TiScriptRunner(26911): Caused by: java.lang.RuntimeException: java.lang.NullPointerException
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.util.AsyncResult.getResult(AsyncResult.java:51)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollDynamicProperty.safeInvoke(KrollDynamicProperty.java:74)
12-30 11:03:40.734: E/TiScriptRunner(26911): ... 26 more
12-30 11:03:40.734: E/TiScriptRunner(26911): Caused by: java.lang.NullPointerException
12-30 11:03:40.734: E/TiScriptRunner(26911): at ti.modules.titanium.ui.UIModule.setOrientation(UIModule.java:155)
12-30 11:03:40.734: E/TiScriptRunner(26911): at ti.modules.titanium.ui.UIModuleBindingGen$34.dynamicSet(UIModuleBindingGen.java:689)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.kroll.KrollDynamicProperty$1.run(KrollDynamicProperty.java:66)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue.handleMessage(TiMessageQueue.java:219)
12-30 11:03:40.734: E/TiScriptRunner(26911): at android.os.Handler.dispatchMessage(Handler.java:95)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue.dispatchMessage(TiMessageQueue.java:320)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue.dispatchPendingMessages(TiMessageQueue.java:304)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue$2.getResult(TiMessageQueue.java:172)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiMessageQueue.sendBlockingMessage(TiMessageQueue.java:196)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollContext.evalFile(KrollContext.java:284)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.kroll.KrollBridge.evalFile(KrollBridge.java:130)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:189)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiContext.evalFile(TiContext.java:209)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiLaunchActivity.loadActivityScript(TiLaunchActivity.java:73)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiLaunchActivity.windowCreated(TiLaunchActivity.java:125)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:299)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiLaunchActivity.onCreate(TiLaunchActivity.java:115)
12-30 11:03:40.734: E/TiScriptRunner(26911): at org.appcelerator.titanium.TiRootActivity.onCreate(TiRootActivity.java:38)
12-30 11:03:40.734: E/TiScriptRunner(26911): at android.app.Instrumentation.callActivityOnCr
12-30 11:03:40.734: E/TiJSError(26911): (kroll$1: app://app.js) [50,1355] ----- Titanium Javascript Runtime Error -----
12-30 11:03:40.734: E/TiJSError(26911): (kroll$1: app://app.js) [1,1356] - In null:0,0
12-30 11:03:40.734: E/TiJSError(26911): (kroll$1: app://app.js) [0,1356] - Message: Wrapped java.lang.RuntimeException: java.lang.NullPointerException
12-30 11:03:40.734: E/TiJSError(26911): (kroll$1: app://app.js) [0,1356] - Source: null
In order for me to escalate this ticket to the core team, it must follow the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist) and hence include full details about your environment and a test case that runs without modification, as per the [Creating a Test Case](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-CreatingaTestCase) section. I will close this for now. Please reopen the ticket once it is complete, and I will move it to the main project.
Setting Ti.UI.orientation...
...on Android results in a crash...
Expected behavior would be that it prints a depreciation warning and keeps working (and eventually does nothing at all, when it's totally removed). This works on iOS and has the intended effect.
Also, I can't reopen this ticket.
Keith Please include all the details about your environment, as per the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist), and then I can escalate this ticket. Thank you
@Opie IIRC isn't orientation read only? (with orientationModes being changeable)
@Paul: You may want to read/bookmark http://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history; my OSX version is 10.6.8. Ti version is indicated in report. TiStud version is irrelevant but 1.0.6. Engine is probably Rhino since 1.7 doesn't give you a choice. Android 2.1, 2.2, 2.3, tested on our standard test devices: * HTC Aria * Samsung Transform * Samsung Infuse * Motorola Droid 2 * HTC Incredible * LG Optimus T
Note that [Titanium.UI.orientation](http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.orientation-property.html) states that this property is writable. Also, it is set in the KitchenSink script, [orientation.js#L136](https://github.com/appcelerator/titanium_mobile/blob/master/demos/KitchenSink/Resources/examples/orientation.js#L136). Opie, if the docs need to be corrected, raise a ticket and I will be happy to action it. Thanks