Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-26317] Android: exception handler throws a NullPointerException

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2018-09-10T19:55:46.000+0000
Affected Version/sn/a
Fix Version/sRelease 7.5.0
ComponentsAndroid
Labelsn/a
ReporterLuc-Edmond Gaspard
AssigneeGary Mathews
Created2018-08-18T02:00:27.000+0000
Updated2018-09-10T19:55:59.000+0000

Description

Hi, I had these issue while I was debugging a native module. When a java exception occurs, a NullPointerException is thrown when jsstack is null, trying to call .contains on a null string. https://github.com/appcelerator/titanium_mobile/blob/dc00603cdc187b56531b615ce8e864c6597157f4/android/titanium/src/java/org/appcelerator/titanium/TiExceptionHandler.java#L100-L105 {quote} Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.contains(java.lang.CharSequence)' on a null object reference at org.appcelerator.titanium.TiExceptionHandler.getError(TiExceptionHandler.java:100) at org.appcelerator.titanium.TiExceptionHandler.handleOpenErrorDialog(TiExceptionHandler.java:141) at org.appcelerator.titanium.TiExceptionHandler.openErrorDialog(TiExceptionHandler.java:121) at org.appcelerator.titanium.TiExceptionHandler.handleException(TiExceptionHandler.java:246) at org.appcelerator.kroll.KrollRuntime.dispatchException(KrollRuntime.java:540) at org.appcelerator.titanium.TiApplication$1.uncaughtException(TiApplication.java:365) at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:677) at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:22) at android.app.Activity.performCreate(Activity.java:6975) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770) ... 9 more {quote} Also, the new exception handler doesn't include the java exception title and message.

Comments

  1. Gary Mathews 2018-08-20

    master: https://github.com/appcelerator/titanium_mobile/pull/10271
  2. Lokesh Choudhary 2018-09-10

    Verified the fix with SDK 7.5.0.v20180906093938. Closing. Studio Ver: 5.1.1.201809051655 SDK Ver: 7.5.0.v20180906093938 OS Ver: 10.13.5 Xcode Ver: Xcode 9.4.1 Appc NPM: 4.2.13 Appc CLI: 7.0.6 Daemon Ver: 1.1.3 Ti CLI Ver: 5.1.1 Alloy Ver: 1.13.2 Node Ver: 8.9.1 NPM Ver: 5.5.1 Java Ver: 10.0.2 Devices: ⇨ google Nexus 5 (Android 6.0.1) ⇨ google Nexus 6P (Android 8.1.0)

JSON Source