You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewRuntimeException("Cannot Resolve Session Bus Address", _ex);
}
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 reason is, that the method passes Supplier<String> to another method. These Suppliers are created using a Lambda expression, which are not allowed to throw any checked exception.
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.
The reason is, that the method passes Supplier<String> to another method. These Suppliers are created using a Lambda expression, which are not allowed to throw any checked exception.
Just fyi, this is not true.
@FunctionalInterfaceinterfaceThrowingSupplier<T> {
Tget() throwsException;
}
// ...ThrowingSupplier<String> foo = () -> { thrownewException(); } // runs just fine
Yes it would be allowed, if it would use a custom ThrowingSupplier, but it doesn't.
Therefore, throwing anything else than RuntimeException is not possible.
Anyways, it also doesn't make any sense to me to comment on already fixed issues.
As you might have seen I removed the Supplier stuff completely, so no need for another solution here
if it would use a custom ThrowingSupplier, but it doesn't
It was only used in a private method, therefore a custom supplier would be easy to use.
Anyways, it also doesn't make any sense to me to comment on already fixed issues.
As you might have seen I removed the Supplier stuff completely, so no need for another solution here
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...
Activity
hypfvieh commentedon Jan 27, 2021
The reason is, that the method passes
Supplier<String>to another method. These Suppliers are created using a Lambda expression, which are not allowed to throw any checked exception.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.
Issue #128: Do not throw RuntimeException in DBusConnection.getConnec…
overheadhunter commentedon Feb 11, 2021
Just fyi, this is not true.
hypfvieh commentedon Feb 11, 2021
Yes it would be allowed, if it would use a custom ThrowingSupplier, but it doesn't.
Therefore, throwing anything else than RuntimeException is not possible.
Anyways, it also doesn't make any sense to me to comment on already fixed issues.
As you might have seen I removed the Supplier stuff completely, so no need for another solution here
overheadhunter commentedon Feb 11, 2021
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...
Update dbus-java to 3.3.0 to fix hypfvieh/dbus-java#128 and cryptomat…