AirshipChannelListener.onChannelCreated called with a null channel ID even when the interface defines it NonNull

Steps: Unknown, most likely just starting up the application.
Device: Samsung Galaxy Note 4, Android 6
Occurrance: Extremely rare, happened so far only for one end user. We are not able to reproduce this.
SDK version: 14.1.1

 

----

The root cause of the problem is that we use Kotlin with the SDK and AirshipChannelListener interface defines channelId as NonNull but when Airship creates a channel it has for some reason been null. AirshipChannel should not be calling this method with a null channel ID.

public interface AirshipChannelListener {

@WorkerThread
void onChannelCreated(@NonNull String channelId);
...

 

As our Kotlin code implements that interface, Kotlin compiler will enforce nullability and cause application to crash by calling Intrinsics.checkNotNullParameter(channelId, "channelId");

We could solve this issue by using Java to implement that interface or by removing Kotlin intrinsics e.g. with R8 or compiler flag.

Additionally we are not using onChannelCreated for anything but we are forced to overwrite it to use onChannelUpdated callback. One option to improve interface segregation principle is to include an empty implementation for this interface in the SDK.

Manifest & build.gradle:

For now I did not include this as there is nothing out of the ordinary and it works for everyone except a single user at this time. We use autopilot so takeOff is not called by app.

Stack trace:

Fatal Exception: java.lang.NullPointerException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter channelId
at com.app....managers.airship.AirshipChannel$listener$1.onChannelCreated(AirshipChannel.java)
at com.urbanairship.channel.AirshipChannel.onCreateChannel(AirshipChannel.java:678)
at com.urbanairship.channel.AirshipChannel.onUpdateChannel(AirshipChannel.java:715)
at com.urbanairship.channel.AirshipChannel.onPerformJob(AirshipChannel.java:223)
at com.urbanairship.job.Job$1.run(Job.java:90)
at com.urbanairship.util.SerialExecutor$1.run(SerialExecutor.java:41)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at com.urbanairship.util.AirshipThreadFactory$1.run(AirshipThreadFactory.java:50)
at java.lang.Thread.run(Thread.java:818)

Didn't find what you were looking for?

New post

Comments

0 comments

Please sign in to leave a comment.