aspnet / SignalR

[Archived] Incredibly simple real-time web for ASP.NET Core. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
2.38k stars 446 forks source link

Java Client: NullPointerException when calling hubConnection.stop(); #3336

Closed kosancicivan closed 6 years ago

kosancicivan commented 6 years ago

So my app crash when want to stop hubConnection. Also, same happens when I close internet connection on android device. I call this method:

hubConnection.stop()
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(() -> Log.d(TAG, "stop: " + "Disconnected"),
                            error -> Log.d(TAG, "stop: " + error.getMessage()));

And get this errors:

com.app D/TAG: stop: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Exception.toString()' on a null object reference

E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: com.app, PID: 25891
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Integer.intValue()' on a null object reference
        at com.microsoft.signalr.WebSocketTransport.lambda$start$1(WebSocketTransport.java:56)
        at com.microsoft.signalr.-$$Lambda$WebSocketTransport$AQhmDI2aQR6xOI_rRCG9Mm31O2o.accept(Unknown Source:6)
        at com.microsoft.signalr.OkHttpWebSocketWrapper$SignalRWebSocketListener.onFailure(OkHttpWebSocketWrapper.java:103)
        at okhttp3.internal.ws.RealWebSocket.failWebSocket(RealWebSocket.java:570)
        at okhttp3.internal.ws.RealWebSocket$2.onResponse(RealWebSocket.java:215)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:153)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

Is there any solution for this problem?

BrennanConroy commented 6 years ago

Dupe of https://github.com/aspnet/SignalR/issues/3319 You can wait for the RTM release or build the client yourself if you want the fix immediately.