Skip to content

[Bug] Failed to obtain the remote object using the DBusPath method. #290

@lucifdch

Description

@lucifdch

Use the string method to obtain the correct result.

// this ok
var om = systemConn.getRemoteObject(
        "org.bluez",
        "/",
        ObjectManager.class
);

Using the DBusPath method will result in an error.

// this error
var om = systemConn.getRemoteObject(
        "org.bluez",
        new DBusPath("/"),
        ObjectManager.class
);
org.freedesktop.dbus.exceptions.InvalidObjectPathException: Invalid object path: /
	at org.freedesktop.dbus.utils.DBusObjects.requireBase(DBusObjects.java:47)
	at org.freedesktop.dbus.utils.DBusObjects.requireObjectPath(DBusObjects.java:163)
	at org.freedesktop.dbus.utils.DBusObjects.requireObjectPath(DBusObjects.java:100)
	at org.freedesktop.dbus.connections.impl.IRemoteObjectGetter.getRemoteObject(IRemoteObjectGetter.java:178)
	at org.example.bluetooth.Demo.main(Demo.java:27)

I looked at the code, and the DBusObjects.requireObjectPath(_objectpath) validation failed.

DBusObjects.validateNotObjectPath(x.getPath()) returns false (which should be correct).

However, the !_validation.test(_input) in DBusObjects.requireBase causes an exception to be thrown even after successful validation.

Therefore, using the following path will pass the verification process:

var om = systemConn.getRemoteObject(
        "org.bluez",
        new DBusPath("/*(&(1"),
        ObjectManager.class
);

version:

implementation("com.github.hypfvieh:dbus-java-core:5.1.1")
implementation("com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.1.1")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions