Upgrade and fix (#16167)

Signed-off-by: Leo Siepel <leosiepel@gmail.com>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
This commit is contained in:
lsiepel 2024-01-01 15:30:28 +01:00 committed by Ciprian Pascu
parent 605372b9c7
commit 1ac1e4d2a4
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;
}