org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException Java Examples
The following examples show how to use
org.whispersystems.signalservice.api.push.exceptions.NetworkFailureException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Manager.java From signal-cli with GNU General Public License v3.0 | 6 votes |
/** * This method throws an EncapsulatedExceptions exception instead of returning a list of SendMessageResult. */ private long sendMessageLegacy(SignalServiceDataMessage.Builder messageBuilder, Collection<SignalServiceAddress> recipients) throws EncapsulatedExceptions, IOException { final long timestamp = System.currentTimeMillis(); messageBuilder.withTimestamp(timestamp); List<SendMessageResult> results = sendMessage(messageBuilder, recipients); List<UntrustedIdentityException> untrustedIdentities = new LinkedList<>(); List<UnregisteredUserException> unregisteredUsers = new LinkedList<>(); List<NetworkFailureException> networkExceptions = new LinkedList<>(); for (SendMessageResult result : results) { if (result.isUnregisteredFailure()) { unregisteredUsers.add(new UnregisteredUserException(result.getAddress().getLegacyIdentifier(), null)); } else if (result.isNetworkFailure()) { networkExceptions.add(new NetworkFailureException(result.getAddress().getLegacyIdentifier(), null)); } else if (result.getIdentityFailure() != null) { untrustedIdentities.add(new UntrustedIdentityException("Untrusted", result.getAddress().getLegacyIdentifier(), result.getIdentityFailure().getIdentityKey())); } } if (!untrustedIdentities.isEmpty() || !unregisteredUsers.isEmpty() || !networkExceptions.isEmpty()) { throw new EncapsulatedExceptions(untrustedIdentities, unregisteredUsers, networkExceptions); } return timestamp; }
Example #2
Source File: RefreshAttributesJob.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public boolean onShouldRetry(@NonNull Exception e) { return e instanceof NetworkFailureException; }
Example #3
Source File: SendMessageResponseList.java From bcm-android with GNU General Public License v3.0 | 4 votes |
public void addException(NetworkFailureException exception) { networkExceptions.add(exception); }
Example #4
Source File: SendMessageResponseList.java From bcm-android with GNU General Public License v3.0 | 4 votes |
public List<NetworkFailureException> getNetworkExceptions() { return networkExceptions; }
Example #5
Source File: JsonNetworkFailureException.java From signald with GNU General Public License v3.0 | 4 votes |
JsonNetworkFailureException(NetworkFailureException e) { this.number = e.getE164number(); }