-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
DBus.getConnection() throws RuntimeException #128
Comments
The reason is, that the method passes I agree that this is not a really good solution. I will change that in the next version, removing the Supplier stuff (does not help or make any sense here at all). I will then throw a DBusConnectionException which is a new exception derived from DBusException, so any existing code should work fine. |
Just fyi, this is not true. @FunctionalInterface
interface ThrowingSupplier<T> {
T get() throws Exception;
}
// ...
ThrowingSupplier<String> foo = () -> { throw new Exception(); } // runs just fine |
Yes it would be allowed, if it would use a custom ThrowingSupplier, but it doesn't. Anyways, it also doesn't make any sense to me to comment on already fixed issues. |
It was only used in a private method, therefore a custom supplier would be easy to use.
I saw it the moment I checked out the code. If the issue had been closed, I would have known this is already fixed. So choose your words carefully here. Didn't mean to hurt your feelings... |
This is a question.
To establish a connection to the DBus, one has to call
DBus.getConnection(DBusBusType _bustype) throws DBusException
(or one its sibling methods.Within this method, at two spots a
RuntimeExeption
is thrown instead of the expectedDBusException
:dbus-java/dbus-java/src/main/java/org/freedesktop/dbus/connections/impl/DBusConnection.java
Lines 259 to 261 in 7f6d908
and
dbus-java/dbus-java/src/main/java/org/freedesktop/dbus/connections/impl/DBusConnection.java
Lines 269 to 271 in 7f6d908
My question is now: Why?
There is already an expected/ checked exception which could be used, namely the
DBusException
. This leads to errors in downstream libraries not anticipating the undocumented exceptions.The text was updated successfully, but these errors were encountered: