-
Notifications
You must be signed in to change notification settings - Fork 4
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
added checks for system-only DBus #4
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ public boolean isSupported() { | |
try (@SuppressWarnings("unused") SimpleCollection keyring = new SimpleCollection()) { | ||
// seems like we're able to access the keyring. | ||
return true; | ||
} catch (IOException | RuntimeException e) { | ||
} catch (IOException | ExceptionInInitializerError | RuntimeException e) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's based upon the actual code running on my setup. With the Session DBus non-existent it threw an ExceptionInInitializerError upon running, so I just added it to the list so it marks it as not supported. Without that, it crashes similarly to the original issue, but with SecretService in the backtrace. |
||
return false; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DBusConnection.getConnection
throws aDBusException
doesn't it? I'd suggest to catch that instead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can throw a DBusException on certain errors but in the case of a non-existent session DBus it is only throwing a RuntimeException as per this line
Caused by: java.lang.RuntimeException: Cannot Resolve Session Bus Address
Using a DBusException in place of it results in the same error as before and the catch is never executed. Maybe I should catch both, though?
There may be a better way to check before the exception is thrown... Let me look into it a bit more.
EDIT: I added in a more specific check in the new push and prettied the code up a bit, trying to conform to the other code. I also took out the stack trace output for the missing session DBus, as it isn't necessary when handled correctly. Let me know what your thoughts are on it.
EDIT 2: Sorry to keep editing, but looking at the source for dbus-java it should be throwing a DBusException. I'm not sure why it isn't in this case. I'm going to try to compile it myself and see how it handles.