This repository was archived by the owner on Oct 29, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
This repository was archived by the owner on Oct 29, 2025. It is now read-only.
The MessageHandler should not return null but throw a DBusException #1
Copy link
Copy link
Closed
Description
My new MessageHandler avoids returning null on my 2.0.0 branch as this only leads to problems, if the case is not handled properly.
| public Object[] send(String service, String path, String iface, String method, String signature, Object... args) { | |
| try { | |
| org.freedesktop.dbus.messages.Message message = new MethodCall( | |
| service, | |
| path, | |
| iface, | |
| method, (byte) 0, signature, args); | |
| connection.sendMessage(message); | |
| org.freedesktop.dbus.messages.Message response = ((MethodCall) message).getReply(2000L); | |
| log.trace(response.toString()); | |
| if (response instanceof org.freedesktop.dbus.errors.Error) { | |
| throw new DBusException(response.getName() + ": " + response.getParameters()[0]); | |
| } | |
| Object[] parameters = response.getParameters(); | |
| log.debug(Arrays.deepToString(parameters)); | |
| return parameters; | |
| } catch (DBusException e) { | |
| log.error(e.toString(), e.getCause()); | |
| } | |
| return null; | |
| } |
see also: swiesend/secret-service#6
Metadata
Metadata
Assignees
Labels
No labels