Closed thibaud-denche closed 6 months ago
Please find the open PR here: https://github.com/NordicSemiconductor/Android-BLE-Library/pull/540 Best regards
Although your PR is OK, it doesn't fix the described issue.
The stack trace point to BleServerManager.java:190, where cancelConnection
is called on BluetoothGattServer
object, which is null:
https://github.com/NordicSemiconductor/Android-BLE-Library/blob/3112b52021cb1e91a5f693fdd7ebca9777de6f6d/ble/src/main/java/no/nordicsemi/android/ble/BleServerManager.java#L187-L192
Could you add a check to that method, ensuring that the server
instance isn't null?
You are right, by mistake I did copy and past the stacktrace from this ticket while trying to format mine 😄 Here is the right stacktrace:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.String android.bluetooth.BluetoothDevice.getAddress()' on a null object reference
android.bluetooth.BluetoothGattServer.cancelConnection (BluetoothGattServer.java:655)
no.nordicsemi.android.ble.BleServerManager.cancelConnection (BleServerManager.java:190)
no.nordicsemi.android.ble.BleManagerHandler.internalDisconnect (BleManagerHandler.java:746)
no.nordicsemi.android.ble.BleManagerHandler.onRequestTimeout (BleManagerHandler.java:1617)
no.nordicsemi.android.ble.TimeoutableRequest.lambda$notifyStarted$0 (TimeoutableRequest.java:230)
no.nordicsemi.android.ble.BleManagerHandler$3.run (BleManagerHandler.java:1638)
java.util.TimerThread.mainLoop (Timer.java:562)
java.util.TimerThread.run (Timer.java:512)
I updated the PR to fix both tickets 👍 Thanks for the quick feedback !
Hello, We are encountering an increasing number of errors reported by firebase in our production environment. It currently affects ~10% of our users.
Please find the stacktrace below:
We currently hotfixed it by doing a version rollback to 2.6.1 but we are still looking for a long-term solution.
May I submit a PR for this? What do you think would be the best, a try/catch for the NullPointerException or to store the object in a final local value before the null check to make it immutable as you did for the serverManager value?
Thank you for the overall work on this library which works excellently. Kind regards, Thibaud