Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexporting object does not remove from introspection #80

Closed
rm5248 opened this issue Nov 5, 2019 · 0 comments
Closed

Unexporting object does not remove from introspection #80

rm5248 opened this issue Nov 5, 2019 · 0 comments

Comments

@rm5248
Copy link
Contributor

rm5248 commented Nov 5, 2019

The following is a very simple minimum example of a DBus-Java program:

import org.freedesktop.dbus.connections.impl.DBusConnection;
import org.freedesktop.dbus.exceptions.DBusException;
import org.freedesktop.dbus.interfaces.DBusInterface;

public class ExportClass implements DBusInterface {

    @Override
    public boolean isRemote() {
        return false;
    }

    @Override
    public String getObjectPath() {
        return "/";
    }

    public static void main(String[] args) throws DBusException, InterruptedException{
        DBusConnection conn = DBusConnection.getConnection(DBusConnection.DBusBusType.SESSION);
        conn.requestBusName( "example.java.dbus" );

        ExportClass ex = new ExportClass();
        conn.exportObject( "/path", ex);

        System.out.println( "Exported object, waiting" );
        Thread.sleep( 5000 );

        conn.unExportObject( "/path" );
        System.out.println( "Unexported object, waiting" );

        Thread.sleep( 5000 );
        System.exit( 0 );
    }

}

When exporting the object, the new node at /path is properly shown in the introspection document, however after it is unexported the node will continue to show up. That is, introspecting results in the following document even if the object has been unexported:

$ qdbus example.java.dbus / org.freedesktop.DBus.Introspectable.Introspect
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node name="/">
<node name="path"/>
</node>

This is contrary to the DBus reference implementation - the path should be removed if it is unexported.

This looks like a problem with the ObjectTree class.

AsamK added a commit to AsamK/dbus-java-1 that referenced this issue May 16, 2020
instead of ignoring all intermediate TreeNodes during Introspection

Fixes hypfvieh#103
And adapts the fix for hypfvieh#80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant