Skip to content

NullPointerException when authorizing private channel subscription #372

@rajatsharma16

Description

@rajatsharma16

Details here: #357. It was closed so I thought I should file a new one.

Crash on com.pusher:pusher-java-client:2.4.4

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.pusher.client.channel.impl.message.AuthResponse.getChannelData()' on a null object reference
       at com.pusher.client.channel.impl.PrivateChannelImpl.authorize(PrivateChannelImpl.java:84)
       at com.pusher.client.channel.impl.PrivateChannelImpl.toSubscribeMessage(PrivateChannelImpl.java:101)
       at com.pusher.client.channel.impl.ChannelManager.lambda$sendOrQueueSubscribeMessage$0(ChannelManager.java:134)
       at com.pusher.client.util.Factory.lambda$queueOnEventThread$0(Factory.java:140)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
       at java.lang.Thread.run(Thread.java:1012)

To reproduce, simply return null or empty string from this method from the ChannelAuthorizer class

String authorize(String channelName, String socketId) throws AuthorizationFailureException;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions