20
20
import org .freedesktop .dbus .exceptions .DBusException ;
21
21
import org .freedesktop .dbus .exceptions .MarshallingException ;
22
22
import org .freedesktop .dbus .exceptions .UnknownTypeCodeException ;
23
+ import org .freedesktop .dbus .interfaces .DBusInterface ;
23
24
import org .freedesktop .dbus .types .UInt16 ;
24
25
import org .freedesktop .dbus .types .UInt32 ;
25
26
import org .freedesktop .dbus .types .UInt64 ;
@@ -530,9 +531,17 @@ private int appendOne(byte[] _sigb, int _sigofs, Object _data) throws DBusExcept
530
531
break ;
531
532
case ArgumentType .STRING :
532
533
case ArgumentType .OBJECT_PATH :
533
- // Strings are marshalled as a UInt32 with the length,
534
- // followed by the String, followed by a null byte.
535
- String payload = _data .toString ();
534
+
535
+ String payload ;
536
+ // if the given data is an object, not a ObjectPath itself
537
+ if (_data instanceof DBusInterface ) {
538
+ payload = ((DBusInterface ) _data ).getObjectPath ();
539
+ } else {
540
+ // Strings are marshalled as a UInt32 with the length,
541
+ // followed by the String, followed by a null byte.
542
+ payload = _data .toString ();
543
+ }
544
+
536
545
byte [] payloadbytes = null ;
537
546
try {
538
547
payloadbytes = payload .getBytes ("UTF-8" );
@@ -1421,4 +1430,4 @@ public interface Endian {
1421
1430
byte BIG = 'B' ;
1422
1431
byte LITTLE = 'l' ;
1423
1432
}
1424
- }
1433
+ }
0 commit comments