Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15996] Android: Intermittent NullPointerException with TiUIButton

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionCannot Reproduce
Resolution Date2020-01-09T22:15:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, community
ReporterCsaba Miklos
AssigneeUnknown
Created2013-12-13T09:02:46.000+0000
Updated2020-01-09T22:15:14.000+0000

Description

Sometimes (randomly) I got a bug in the Android Emulator: [ERROR][TiApplication( 984)] (main) [762,14026] Sending event: exception on thread: main msg:java.lang.NullPointerException; Titanium 3.1.3,2013/09/18 12:01,222f4d1 [ERROR][TiApplication( 984)] java.lang.NullPointerException [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.TiUIButton.processProperties(TiUIButton.java:73) [ERROR][TiApplication( 984)] at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1162) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:469) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:476) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:460) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:438) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.proxy.TiViewProxy.forceCreateView(TiViewProxy.java:406) [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.createControls(TiTableViewRowProxyItem.java:246) [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:408) [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.tableview.TiTableViewRowProxyItem.setRowData(TiTableViewRowProxyItem.java:90) [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.tableview.TiTableView$TTVListAdapter.getView(TiTableView.java:229) [ERROR][TiApplication( 984)] at android.widget.AbsListView.obtainView(AbsListView.java:2033) [ERROR][TiApplication( 984)] at android.widget.ListView.makeAndAddView(ListView.java:1772) [ERROR][TiApplication( 984)] at android.widget.ListView.fillDown(ListView.java:672) [ERROR][TiApplication( 984)] at android.widget.ListView.fillFromTop(ListView.java:732) [ERROR][TiApplication( 984)] at android.widget.ListView.layoutChildren(ListView.java:1611) [ERROR][TiApplication( 984)] at android.widget.AbsListView.onLayout(AbsListView.java:1863) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.widget.FrameLayout.onLayout(FrameLayout.java:431) [ERROR][TiApplication( 984)] at ti.modules.titanium.ui.widget.tableview.TiTableView.onLayout(TiTableView.java:572) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.widget.FrameLayout.onLayout(FrameLayout.java:431) [ERROR][TiApplication( 984)] at android.widget.ScrollView.onLayout(ScrollView.java:1405) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.support.v4.view.ViewPager.onLayout(ViewPager.java:1388) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.widget.FrameLayout.onLayout(FrameLayout.java:431) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at org.appcelerator.titanium.view.TiCompositeLayout.onLayout(TiCompositeLayout.java:578) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.widget.FrameLayout.onLayout(FrameLayout.java:431) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:4224) [ERROR][TiApplication( 984)] at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628) [ERROR][TiApplication( 984)] at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486) [ERROR][TiApplication( 984)] at android.widget.LinearLayout.onLayout(LinearLayout.java:1399) [ERROR][TiApplication( 984)] at android.view.View.layout(View.java:11278) [ERROR][TiApplication( 984)] at android.view.ViewGroup.layout(ViewGroup.java:422 As I try to find the reason of this bug I find the source code of the TiUIButton somewhere here: https://github.com/appcelerator/titanium_mobile/blob/1ada7b77dd87dd5491f0f348b7794d21de47fc56/android/modules/ui/src/java/ti/modules/titanium/ui/widget/TiUIButton.java I would like to ask a that is there any reason why you don't check for NullPointer at line 56 (in the current version line 63)? Thanks, Csaba

Comments

  1. Ritu Agrawal 2013-12-15

    I cannot reproduce this issue with Titanium SDK 3.1.3 and a simple test case but it appears to be an intermittent issue based on the call stack. I looked at the code mentioned above but I am not sure if getNativeView() guarantees a valid button object or if it can return null. Button btn = (Button) getNativeView(); We need to protect against null if this function can return null as we call the following function on btn object. btn.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null);
  2. Sunila 2014-01-05

    I don't think checking for null is the right fix. We need to find out why the getNativeView is returning null. Can we get the sample code that caused this exception? Thanks Sunil
  3. Alan Hutton 2020-01-09

    This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. If community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.

JSON Source