Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-25471] Android: TableView : java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.HashMap.containsKey(java.lang.Object)' on a null object reference

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-11-15T04:29:11.000+0000
Affected Version/sRelease 6.3.0
Fix Version/sRelease 7.0.0
ComponentsAndroid
Labelsn/a
Reporterankur garha
AssigneeGary Mathews
Created2017-11-01T07:33:49.000+0000
Updated2017-11-15T07:42:04.000+0000

Description

It's happening when you have multiple nested windows with table views and click back button quickly to close the application. Here is the complete crash log:- 11-01 00:56:36.663: E/AndroidRuntime(22347): java.lang.RuntimeException: Unable to destroy activity {com.homeinspectorpro.mobile/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.HashMap.containsKey(java.lang.Object)' on a null object reference 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4244) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4262) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread.-wrap6(ActivityThread.java) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.os.Handler.dispatchMessage(Handler.java:102) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.os.Looper.loop(Looper.java:154) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread.main(ActivityThread.java:6165) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at java.lang.reflect.Method.invoke(Native Method) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778) 11-01 00:56:36.663: E/AndroidRuntime(22347): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.util.HashMap.containsKey(java.lang.Object)' on a null object reference 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.KrollProxy.hasProperty(KrollProxy.java:580) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:175) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1222) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:516) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:507) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:485) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at ti.modules.titanium.ui.TableViewProxy.getTableView(TableViewProxy.java:147) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:860) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.os.Handler.dispatchMessage(Handler.java:98) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:394) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:379) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:257) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:291) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:191) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:800) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.proxy.TiWindowProxy.closeFromActivity(TiWindowProxy.java:206) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.TiBaseActivity.onDestroy(TiBaseActivity.java:1591) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at org.appcelerator.titanium.TiActivity.onDestroy(TiActivity.java:32) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.Activity.performDestroy(Activity.java:6889) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1175) 11-01 00:56:36.663: E/AndroidRuntime(22347):   at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4231) 11-01 00:56:36.663: E/AndroidRuntime(22347):   ... 9 more

Comments

  1. Hans Knöchel 2017-11-01

    Thanks for reporting! Did this not happen before 6.2.x? cc [~jquick]
  2. Joshua Quick 2017-11-01

    [~sdarda], would you mind trying to reproduce this please? I suspect that this can happen if you set up a TableView with a SearchView, launch the app, and then quickly back out of the app. You'll likely need to quickly tap the back key as the app is launching (it'll queue the back key event) to reproduce this issue. [~hknoechel], I don't think this is a regression. I suspect this issue has always existed.
  3. Gary Mathews 2017-11-01

    master: https://github.com/appcelerator/titanium_mobile/pull/9579
  4. Dominic Maricic 2017-11-01

    This has existed for a long time. We do definitely have a search view involved and it DOES happen when we quickly back out of the app.
  5. ankur garha 2017-11-10

    Gary, I tried applying your patch, it solved this problem but its giving rise to another crash. Please find the logs attached below.
       11-10 01:14:50.846: E/AndroidRuntime(6564): java.lang.RuntimeException: Unable to destroy activity {com.homeinspectorpro.mobile/org.appcelerator.titanium.TiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void ti.modules.titanium.ui.widget.TiUITableView.updateView()' on a null object reference
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4244)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4262)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread.-wrap6(ActivityThread.java)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1551)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.os.Handler.dispatchMessage(Handler.java:102)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.os.Looper.loop(Looper.java:154)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread.main(ActivityThread.java:6165)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at java.lang.reflect.Method.invoke(Native Method)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
       11-10 01:14:50.846: E/AndroidRuntime(6564): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void ti.modules.titanium.ui.widget.TiUITableView.updateView()' on a null object reference
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at ti.modules.titanium.ui.TableViewProxy.handleMessage(TableViewProxy.java:860)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.os.Handler.dispatchMessage(Handler.java:98)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.common.TiMessenger.dispatchMessage(TiMessenger.java:394)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.common.TiMessenger.dispatchPendingMessages(TiMessenger.java:379)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.common.TiMessenger$2.getResult(TiMessenger.java:257)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingMessage(TiMessenger.java:291)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.common.TiMessenger.sendBlockingRuntimeMessage(TiMessenger.java:191)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.kroll.KrollProxy.fireSyncEvent(KrollProxy.java:812)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.titanium.proxy.TiWindowProxy.closeFromActivity(TiWindowProxy.java:206)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.titanium.TiBaseActivity.onDestroy(TiBaseActivity.java:1596)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at org.appcelerator.titanium.TiActivity.onDestroy(TiActivity.java:32)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.Activity.performDestroy(Activity.java:6889)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1175)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4231)
       11-10 01:14:50.846: E/AndroidRuntime(6564): 	... 9 more
       
       
  6. Gary Mathews 2017-11-11

    [~speedyankur@gmail.com] I've updated the PR, report back after trying the new changes?
  7. Abir Mukherjee 2017-11-15

    Changes are seen in SDK 7.0.0.v20171114203226.

JSON Source