Upgrade and fix (#16167)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2024-01-01 15:30:28 +01:00 committed by GitHub
parent d53bf5dda1
commit 057de3e73b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -26,7 +26,7 @@
<dependency>
<groupId>com.github.hypfvieh</groupId>
<artifactId>bluez-dbus-osgi</artifactId>
<version>0.1.3</version>
<version>0.1.4</version>
<scope>provided</scope>
</dependency>

View File

@ -22,6 +22,7 @@ import java.util.concurrent.TimeUnit;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.freedesktop.dbus.errors.NoReply;
import org.freedesktop.dbus.errors.UnknownObject;
import org.freedesktop.dbus.exceptions.DBusException;
import org.freedesktop.dbus.exceptions.DBusExecutionException;
import org.freedesktop.dbus.types.UInt16;
@ -195,7 +196,12 @@ public class BlueZBluetoothDevice extends BaseBluetoothDevice implements BlueZEv
BluetoothDevice dev = device;
if (dev != null) {
logger.debug("Disconnecting '{}'", address);
return dev.disconnect();
try {
return dev.disconnect();
} catch (UnknownObject exception) {
logger.debug("Failed to disconnect the device, UnknownObject", exception);
return false;
}
}
return false;
}