Minor dbus-java issues

Robert Middleton rmiddleton at synexxus.com
Tue Mar 20 14:00:23 PDT 2012


Just a few minor issues with dbus-java that I've noticed and fixed on my
end, figured this should be fixed in the main trunk:

1. In line 469/470 of AbstractConnection.java(queueOutgoing), the 'if(null
== outgoing)' should be outside of the synchronized block; otherwise if you
have disconnected from the bus a NullPointerException will be thrown. (I
only noticed this when I apparently sent an invalid string over the bus and
tried to send a new message; It seems as though sending a string that's not
properly formatted in UTF-8 will kick you off?)
2. When using callMethodAsync, if you are calling a method which takes in
an array(i.e. java.util.List), the method call will fail because the
library will not properly see that whatever you're passing in is of type
List, it will only see the implementation type(i.e. ArrayList). To fix
this, I've changed the loop in callMethodAsync in AbstractConnection.java
to look like this:

for (int i = 0; i < parameters.length; i++){
types[i] = parameters[i].getClass();
if( parameters[i] instanceof java.util.List<?> ){
try{
types[i] = Class.forName("java.util.List");
}catch(ClassNotFoundException e){}
}
}

I haven't tried this with structs(as for what I'm doing they're not
needed), but I suspect that the same issue would occur.
This fix would also have to be applied to callWithCallback.

-Robert Middleton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20120320/f9830346/attachment.htm>


More information about the dbus mailing list