1 package org
.asamk
.signal
.dbus
;
3 import org
.asamk
.Signal
;
4 import org
.asamk
.signal
.BaseConfig
;
5 import org
.asamk
.signal
.manager
.AttachmentInvalidException
;
6 import org
.asamk
.signal
.manager
.Manager
;
7 import org
.asamk
.signal
.manager
.NotMasterDeviceException
;
8 import org
.asamk
.signal
.manager
.StickerPackInvalidException
;
9 import org
.asamk
.signal
.manager
.UntrustedIdentityException
;
10 import org
.asamk
.signal
.manager
.api
.Device
;
11 import org
.asamk
.signal
.manager
.api
.Identity
;
12 import org
.asamk
.signal
.manager
.api
.Message
;
13 import org
.asamk
.signal
.manager
.api
.RecipientIdentifier
;
14 import org
.asamk
.signal
.manager
.api
.TypingAction
;
15 import org
.asamk
.signal
.manager
.groups
.GroupId
;
16 import org
.asamk
.signal
.manager
.groups
.GroupInviteLinkUrl
;
17 import org
.asamk
.signal
.manager
.groups
.GroupNotFoundException
;
18 import org
.asamk
.signal
.manager
.groups
.GroupSendingNotAllowedException
;
19 import org
.asamk
.signal
.manager
.groups
.LastGroupAdminException
;
20 import org
.asamk
.signal
.manager
.groups
.NotAGroupMemberException
;
21 import org
.asamk
.signal
.manager
.storage
.recipients
.Profile
;
22 import org
.asamk
.signal
.manager
.storage
.recipients
.RecipientAddress
;
23 import org
.asamk
.signal
.util
.ErrorUtils
;
24 import org
.freedesktop
.dbus
.exceptions
.DBusExecutionException
;
25 import org
.whispersystems
.libsignal
.InvalidKeyException
;
26 import org
.whispersystems
.libsignal
.util
.Pair
;
27 import org
.whispersystems
.libsignal
.util
.guava
.Optional
;
28 import org
.whispersystems
.signalservice
.api
.groupsv2
.GroupLinkNotActiveException
;
29 import org
.whispersystems
.signalservice
.api
.messages
.SendMessageResult
;
30 import org
.whispersystems
.signalservice
.api
.push
.exceptions
.UnregisteredUserException
;
31 import org
.whispersystems
.signalservice
.api
.util
.InvalidNumberException
;
32 import org
.whispersystems
.signalservice
.internal
.contacts
.crypto
.UnauthenticatedResponseException
;
35 import java
.io
.IOException
;
37 import java
.net
.URISyntaxException
;
38 import java
.util
.ArrayList
;
39 import java
.util
.Collection
;
40 import java
.util
.HashSet
;
41 import java
.util
.List
;
43 import java
.util
.Objects
;
45 import java
.util
.UUID
;
46 import java
.util
.stream
.Collectors
;
47 import java
.util
.stream
.Stream
;
49 public class DbusSignalImpl
implements Signal
{
51 private final Manager m
;
52 private final String objectPath
;
54 public DbusSignalImpl(final Manager m
, final String objectPath
) {
56 this.objectPath
= objectPath
;
60 public boolean isRemote() {
65 public String
getObjectPath() {
70 public String
getNumber() {
71 return m
.getSelfNumber();
75 public void addDevice(String uri
) {
77 m
.addDeviceLink(new URI(uri
));
78 } catch (IOException
| InvalidKeyException e
) {
79 throw new Error
.Failure(e
.getClass().getSimpleName() + " Add device link failed. " + e
.getMessage());
80 } catch (URISyntaxException e
) {
81 throw new Error
.InvalidUri(e
.getClass().getSimpleName()
82 + " Device link uri has invalid format: "
88 public void removeDevice(int deviceId
) {
90 m
.removeLinkedDevices(deviceId
);
91 } catch (IOException e
) {
92 throw new Error
.Failure(e
.getClass().getSimpleName() + ": Error while removing device: " + e
.getMessage());
97 public List
<String
> listDevices() {
99 List
<String
> results
= new ArrayList
<String
>();
102 devices
= m
.getLinkedDevices();
103 } catch (IOException
| Error
.Failure e
) {
104 throw new Error
.Failure("Failed to get linked devices: " + e
.getMessage());
107 return devices
.stream().map(d
-> d
.getName() == null ?
"" : d
.getName()).collect(Collectors
.toList());
111 public void updateDeviceName(String deviceName
) {
113 m
.updateAccountAttributes(deviceName
);
114 } catch (IOException
| Signal
.Error
.Failure e
) {
115 throw new Error
.Failure("UpdateAccount error: " + e
.getMessage());
120 public long sendMessage(final String message
, final List
<String
> attachments
, final String recipient
) {
121 var recipients
= new ArrayList
<String
>(1);
122 recipients
.add(recipient
);
123 return sendMessage(message
, attachments
, recipients
);
127 public long sendMessage(final String message
, final List
<String
> attachments
, final List
<String
> recipients
) {
129 final var results
= m
.sendMessage(new Message(message
, attachments
),
130 getSingleRecipientIdentifiers(recipients
, m
.getSelfNumber()).stream()
131 .map(RecipientIdentifier
.class::cast
)
132 .collect(Collectors
.toSet()));
134 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
135 return results
.getTimestamp();
136 } catch (AttachmentInvalidException e
) {
137 throw new Error
.AttachmentInvalid(e
.getMessage());
138 } catch (IOException e
) {
139 throw new Error
.Failure(e
.getMessage());
140 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
141 throw new Error
.GroupNotFound(e
.getMessage());
146 public long sendRemoteDeleteMessage(
147 final long targetSentTimestamp
, final String recipient
149 var recipients
= new ArrayList
<String
>(1);
150 recipients
.add(recipient
);
151 return sendRemoteDeleteMessage(targetSentTimestamp
, recipients
);
155 public long sendRemoteDeleteMessage(
156 final long targetSentTimestamp
, final List
<String
> recipients
159 final var results
= m
.sendRemoteDeleteMessage(targetSentTimestamp
,
160 getSingleRecipientIdentifiers(recipients
, m
.getSelfNumber()).stream()
161 .map(RecipientIdentifier
.class::cast
)
162 .collect(Collectors
.toSet()));
163 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
164 return results
.getTimestamp();
165 } catch (IOException e
) {
166 throw new Error
.Failure(e
.getMessage());
167 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
168 throw new Error
.GroupNotFound(e
.getMessage());
173 public long sendGroupRemoteDeleteMessage(
174 final long targetSentTimestamp
, final byte[] groupId
177 final var results
= m
.sendRemoteDeleteMessage(targetSentTimestamp
,
178 Set
.of(new RecipientIdentifier
.Group(getGroupId(groupId
))));
179 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
180 return results
.getTimestamp();
181 } catch (IOException e
) {
182 throw new Error
.Failure(e
.getMessage());
183 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
184 throw new Error
.GroupNotFound(e
.getMessage());
189 public long sendMessageReaction(
191 final boolean remove
,
192 final String targetAuthor
,
193 final long targetSentTimestamp
,
194 final String recipient
196 var recipients
= new ArrayList
<String
>(1);
197 recipients
.add(recipient
);
198 return sendMessageReaction(emoji
, remove
, targetAuthor
, targetSentTimestamp
, recipients
);
202 public long sendMessageReaction(
204 final boolean remove
,
205 final String targetAuthor
,
206 final long targetSentTimestamp
,
207 final List
<String
> recipients
210 final var results
= m
.sendMessageReaction(emoji
,
212 getSingleRecipientIdentifier(targetAuthor
, m
.getSelfNumber()),
214 getSingleRecipientIdentifiers(recipients
, m
.getSelfNumber()).stream()
215 .map(RecipientIdentifier
.class::cast
)
216 .collect(Collectors
.toSet()));
217 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
218 return results
.getTimestamp();
219 } catch (IOException e
) {
220 throw new Error
.Failure(e
.getMessage());
221 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
222 throw new Error
.GroupNotFound(e
.getMessage());
227 public void sendTyping(
228 final String recipient
, final boolean stop
229 ) throws Error
.Failure
, Error
.GroupNotFound
, Error
.UntrustedIdentity
{
231 var recipients
= new ArrayList
<String
>(1);
232 recipients
.add(recipient
);
233 m
.sendTypingMessage(stop ? TypingAction
.STOP
: TypingAction
.START
,
234 getSingleRecipientIdentifiers(recipients
, m
.getSelfNumber()).stream()
235 .map(RecipientIdentifier
.class::cast
)
236 .collect(Collectors
.toSet()));
237 } catch (IOException e
) {
238 throw new Error
.Failure(e
.getMessage());
239 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
240 throw new Error
.GroupNotFound(e
.getMessage());
241 } catch (UntrustedIdentityException e
) {
242 throw new Error
.UntrustedIdentity(e
.getMessage());
247 public void sendReadReceipt(
248 final String recipient
, final List
<Long
> messageIds
249 ) throws Error
.Failure
, Error
.UntrustedIdentity
{
251 m
.sendReadReceipt(getSingleRecipientIdentifier(recipient
, m
.getSelfNumber()), messageIds
);
252 } catch (IOException e
) {
253 throw new Error
.Failure(e
.getMessage());
254 } catch (UntrustedIdentityException e
) {
255 throw new Error
.UntrustedIdentity(e
.getMessage());
260 public void sendContacts() {
263 } catch (IOException e
) {
264 throw new Error
.Failure("SendContacts error: " + e
.getMessage());
269 public void sendSyncRequest() {
271 m
.requestAllSyncData();
272 } catch (IOException e
) {
273 throw new Error
.Failure("Request sync data error: " + e
.getMessage());
278 public long sendNoteToSelfMessage(
279 final String message
, final List
<String
> attachments
280 ) throws Error
.AttachmentInvalid
, Error
.Failure
, Error
.UntrustedIdentity
{
282 final var results
= m
.sendMessage(new Message(message
, attachments
),
283 Set
.of(RecipientIdentifier
.NoteToSelf
.INSTANCE
));
284 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
285 return results
.getTimestamp();
286 } catch (AttachmentInvalidException e
) {
287 throw new Error
.AttachmentInvalid(e
.getMessage());
288 } catch (IOException e
) {
289 throw new Error
.Failure(e
.getMessage());
290 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
291 throw new Error
.GroupNotFound(e
.getMessage());
296 public void sendEndSessionMessage(final List
<String
> recipients
) {
298 final var results
= m
.sendEndSessionMessage(getSingleRecipientIdentifiers(recipients
, m
.getSelfNumber()));
299 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
300 } catch (IOException e
) {
301 throw new Error
.Failure(e
.getMessage());
306 public long sendGroupMessage(final String message
, final List
<String
> attachments
, final byte[] groupId
) {
308 var results
= m
.sendMessage(new Message(message
, attachments
),
309 Set
.of(new RecipientIdentifier
.Group(getGroupId(groupId
))));
310 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
311 return results
.getTimestamp();
312 } catch (IOException e
) {
313 throw new Error
.Failure(e
.getMessage());
314 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
315 throw new Error
.GroupNotFound(e
.getMessage());
316 } catch (AttachmentInvalidException e
) {
317 throw new Error
.AttachmentInvalid(e
.getMessage());
322 public long sendGroupMessageReaction(
324 final boolean remove
,
325 final String targetAuthor
,
326 final long targetSentTimestamp
,
330 final var results
= m
.sendMessageReaction(emoji
,
332 getSingleRecipientIdentifier(targetAuthor
, m
.getSelfNumber()),
334 Set
.of(new RecipientIdentifier
.Group(getGroupId(groupId
))));
335 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
336 return results
.getTimestamp();
337 } catch (IOException e
) {
338 throw new Error
.Failure(e
.getMessage());
339 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
340 throw new Error
.GroupNotFound(e
.getMessage());
344 // Since contact names might be empty if not defined, also potentially return
347 public String
getContactName(final String number
) {
348 return m
.getContactOrProfileName(getSingleRecipientIdentifier(number
, m
.getSelfNumber()));
352 public void setContactName(final String number
, final String name
) {
354 m
.setContactName(getSingleRecipientIdentifier(number
, m
.getSelfNumber()), name
);
355 } catch (NotMasterDeviceException e
) {
356 throw new Error
.Failure("This command doesn't work on linked devices.");
357 } catch (UnregisteredUserException e
) {
358 throw new Error
.Failure("Contact is not registered.");
363 public void setExpirationTimer(final String number
, final int expiration
) {
365 m
.setExpirationTimer(getSingleRecipientIdentifier(number
, m
.getSelfNumber()), expiration
);
366 } catch (IOException e
) {
367 throw new Error
.Failure(e
.getMessage());
372 public void setContactBlocked(final String number
, final boolean blocked
) {
374 m
.setContactBlocked(getSingleRecipientIdentifier(number
, m
.getSelfNumber()), blocked
);
375 } catch (NotMasterDeviceException e
) {
376 throw new Error
.Failure("This command doesn't work on linked devices.");
377 } catch (IOException e
) {
378 throw new Error
.Failure(e
.getMessage());
383 public void setGroupBlocked(final byte[] groupId
, final boolean blocked
) {
385 m
.setGroupBlocked(getGroupId(groupId
), blocked
);
386 } catch (GroupNotFoundException e
) {
387 throw new Error
.GroupNotFound(e
.getMessage());
388 } catch (IOException e
) {
389 throw new Error
.Failure(e
.getMessage());
394 public List
<byte[]> getGroupIds() {
395 var groups
= m
.getGroups();
396 var ids
= new ArrayList
<byte[]>(groups
.size());
397 for (var group
: groups
) {
398 ids
.add(group
.getGroupId().serialize());
404 public String
getGroupName(final byte[] groupId
) {
405 var group
= m
.getGroup(getGroupId(groupId
));
409 return group
.getTitle();
414 public List
<String
> getGroupMembers(final byte[] groupId
) {
415 var group
= m
.getGroup(getGroupId(groupId
));
419 return group
.getMembers().stream().map(RecipientAddress
::getLegacyIdentifier
).collect(Collectors
.toList());
424 public byte[] updateGroup(byte[] groupId
, String name
, List
<String
> members
, String avatar
) {
426 if (groupId
.length
== 0) {
429 if (name
.isEmpty()) {
432 if (avatar
.isEmpty()) {
435 final var memberIdentifiers
= getSingleRecipientIdentifiers(members
, m
.getSelfNumber());
436 if (groupId
== null) {
437 final var results
= m
.createGroup(name
, memberIdentifiers
, avatar
== null ?
null : new File(avatar
));
438 checkSendMessageResults(results
.second().getTimestamp(), results
.second().getResults());
439 return results
.first().serialize();
441 final var results
= m
.updateGroup(getGroupId(groupId
),
452 avatar
== null ?
null : new File(avatar
),
455 if (results
!= null) {
456 checkSendMessageResults(results
.getTimestamp(), results
.getResults());
460 } catch (IOException e
) {
461 throw new Error
.Failure(e
.getMessage());
462 } catch (GroupNotFoundException
| NotAGroupMemberException
| GroupSendingNotAllowedException e
) {
463 throw new Error
.GroupNotFound(e
.getMessage());
464 } catch (AttachmentInvalidException e
) {
465 throw new Error
.AttachmentInvalid(e
.getMessage());
470 public boolean isRegistered() {
475 public boolean isRegistered(String number
) {
476 var result
= isRegistered(List
.of(number
));
477 return result
.get(0);
481 public List
<Boolean
> isRegistered(List
<String
> numbers
) {
482 var results
= new ArrayList
<Boolean
>();
483 if (numbers
.isEmpty()) {
487 Map
<String
, Pair
<String
, UUID
>> registered
;
489 registered
= m
.areUsersRegistered(new HashSet
<>(numbers
));
490 } catch (IOException e
) {
491 throw new Error
.Failure(e
.getMessage());
494 return numbers
.stream().map(number
-> {
495 var uuid
= registered
.get(number
).second();
497 }).collect(Collectors
.toList());
501 public void updateProfile(
502 final String givenName
,
503 final String familyName
,
505 final String aboutEmoji
,
507 final boolean removeAvatar
510 if (avatarPath
.isEmpty()) {
513 Optional
<File
> avatarFile
= removeAvatar
515 : avatarPath
== null ?
null : Optional
.of(new File(avatarPath
));
516 m
.setProfile(givenName
, familyName
, about
, aboutEmoji
, avatarFile
);
517 } catch (IOException e
) {
518 throw new Error
.Failure(e
.getMessage());
523 public void updateProfile(
526 final String aboutEmoji
,
528 final boolean removeAvatar
531 if (avatarPath
.isEmpty()) {
534 Optional
<File
> avatarFile
= removeAvatar
536 : avatarPath
== null ?
null : Optional
.of(new File(avatarPath
));
537 m
.setProfile(name
, null, about
, aboutEmoji
, avatarFile
);
538 } catch (IOException e
) {
539 throw new Error
.Failure(e
.getMessage());
544 public void removePin() {
546 m
.setRegistrationLockPin(Optional
.absent());
547 } catch (UnauthenticatedResponseException e
) {
548 throw new Error
.Failure("Remove pin failed with unauthenticated response: " + e
.getMessage());
549 } catch (IOException e
) {
550 throw new Error
.Failure("Remove pin error: " + e
.getMessage());
555 public void setPin(String registrationLockPin
) {
557 m
.setRegistrationLockPin(Optional
.of(registrationLockPin
));
558 } catch (UnauthenticatedResponseException e
) {
559 throw new Error
.Failure("Set pin error failed with unauthenticated response: " + e
.getMessage());
560 } catch (IOException e
) {
561 throw new Error
.Failure("Set pin error: " + e
.getMessage());
565 // Provide option to query a version string in order to react on potential
566 // future interface changes
568 public String
version() {
569 return BaseConfig
.PROJECT_VERSION
;
572 // Create a unique list of Numbers from Identities and Contacts to really get
573 // all numbers the system knows
575 public List
<String
> listNumbers() {
576 return Stream
.concat(m
.getIdentities().stream().map(Identity
::getRecipient
),
577 m
.getContacts().stream().map(Pair
::first
))
578 .map(a
-> a
.getNumber().orElse(null))
579 .filter(Objects
::nonNull
)
581 .collect(Collectors
.toList());
585 public List
<String
> getContactNumber(final String name
) {
586 // Contact names have precedence.
587 var numbers
= new ArrayList
<String
>();
588 var contacts
= m
.getContacts();
589 for (var c
: contacts
) {
590 if (name
.equals(c
.second().getName())) {
591 numbers
.add(c
.first().getLegacyIdentifier());
594 // Try profiles if no contact name was found
595 for (var identity
: m
.getIdentities()) {
596 final var address
= identity
.getRecipient();
597 var number
= address
.getNumber().orElse(null);
598 if (number
!= null) {
599 Profile profile
= null;
601 profile
= m
.getRecipientProfile(RecipientIdentifier
.Single
.fromAddress(address
));
602 } catch (UnregisteredUserException ignored
) {
604 if (profile
!= null && profile
.getDisplayName().equals(name
)) {
613 public void quitGroup(final byte[] groupId
) {
614 var group
= getGroupId(groupId
);
616 m
.quitGroup(group
, Set
.of());
617 } catch (GroupNotFoundException
| NotAGroupMemberException e
) {
618 throw new Error
.GroupNotFound(e
.getMessage());
619 } catch (IOException
| LastGroupAdminException e
) {
620 throw new Error
.Failure(e
.getMessage());
625 public byte[] joinGroup(final String groupLink
) {
627 final var linkUrl
= GroupInviteLinkUrl
.fromUri(groupLink
);
628 if (linkUrl
== null) {
629 throw new Error
.Failure("Group link is invalid:");
631 final var result
= m
.joinGroup(linkUrl
);
632 return result
.first().serialize();
633 } catch (GroupInviteLinkUrl
.InvalidGroupLinkException
| GroupLinkNotActiveException e
) {
634 throw new Error
.Failure("Group link is invalid: " + e
.getMessage());
635 } catch (GroupInviteLinkUrl
.UnknownGroupLinkVersionException e
) {
636 throw new Error
.Failure("Group link was created with an incompatible version: " + e
.getMessage());
637 } catch (IOException e
) {
638 throw new Error
.Failure(e
.getMessage());
643 public boolean isContactBlocked(final String number
) {
644 return m
.isContactBlocked(getSingleRecipientIdentifier(number
, m
.getSelfNumber()));
648 public boolean isGroupBlocked(final byte[] groupId
) {
649 var group
= m
.getGroup(getGroupId(groupId
));
653 return group
.isBlocked();
658 public boolean isMember(final byte[] groupId
) {
659 var group
= m
.getGroup(getGroupId(groupId
));
663 return group
.isMember();
668 public String
uploadStickerPack(String stickerPackPath
) {
669 File path
= new File(stickerPackPath
);
671 return m
.uploadStickerPack(path
).toString();
672 } catch (IOException e
) {
673 throw new Error
.Failure("Upload error (maybe image size is too large):" + e
.getMessage());
674 } catch (StickerPackInvalidException e
) {
675 throw new Error
.Failure("Invalid sticker pack: " + e
.getMessage());
679 private static void checkSendMessageResult(long timestamp
, SendMessageResult result
) throws DBusExecutionException
{
680 var error
= ErrorUtils
.getErrorMessageFromSendMessageResult(result
);
686 final var message
= timestamp
+ "\nFailed to send message:\n" + error
+ '\n';
688 if (result
.getIdentityFailure() != null) {
689 throw new Error
.UntrustedIdentity(message
);
691 throw new Error
.Failure(message
);
695 private static void checkSendMessageResults(
696 long timestamp
, Map
<RecipientIdentifier
, List
<SendMessageResult
>> results
697 ) throws DBusExecutionException
{
698 final var sendMessageResults
= results
.values().stream().findFirst();
699 if (results
.size() == 1 && sendMessageResults
.get().size() == 1) {
700 checkSendMessageResult(timestamp
, sendMessageResults
.get().stream().findFirst().get());
704 var errors
= ErrorUtils
.getErrorMessagesFromSendMessageResults(results
);
705 if (errors
.size() == 0) {
709 var message
= new StringBuilder();
710 message
.append(timestamp
).append('\n');
711 message
.append("Failed to send (some) messages:\n");
712 for (var error
: errors
) {
713 message
.append(error
).append('\n');
716 throw new Error
.Failure(message
.toString());
719 private static void checkSendMessageResults(
720 long timestamp
, Collection
<SendMessageResult
> results
721 ) throws DBusExecutionException
{
722 if (results
.size() == 1) {
723 checkSendMessageResult(timestamp
, results
.stream().findFirst().get());
727 var errors
= ErrorUtils
.getErrorMessagesFromSendMessageResults(results
);
728 if (errors
.size() == 0) {
732 var message
= new StringBuilder();
733 message
.append(timestamp
).append('\n');
734 message
.append("Failed to send (some) messages:\n");
735 for (var error
: errors
) {
736 message
.append(error
).append('\n');
739 throw new Error
.Failure(message
.toString());
742 private static Set
<RecipientIdentifier
.Single
> getSingleRecipientIdentifiers(
743 final Collection
<String
> recipientStrings
, final String localNumber
744 ) throws DBusExecutionException
{
745 final var identifiers
= new HashSet
<RecipientIdentifier
.Single
>();
746 for (var recipientString
: recipientStrings
) {
747 identifiers
.add(getSingleRecipientIdentifier(recipientString
, localNumber
));
752 private static RecipientIdentifier
.Single
getSingleRecipientIdentifier(
753 final String recipientString
, final String localNumber
754 ) throws DBusExecutionException
{
756 return RecipientIdentifier
.Single
.fromString(recipientString
, localNumber
);
757 } catch (InvalidNumberException e
) {
758 throw new Error
.InvalidNumber(e
.getMessage());
762 private static GroupId
getGroupId(byte[] groupId
) throws DBusExecutionException
{
764 return GroupId
.unknownVersion(groupId
);
765 } catch (Throwable e
) {
766 throw new Error
.InvalidGroupId("Invalid group id: " + e
.getMessage());