org.whispersystems.signalservice.api.InvalidMessageStructureException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of signal-service-java Show documentation
Show all versions of signal-service-java Show documentation
Signal Service communication library for Java, unofficial fork
package org.whispersystems.signalservice.api;
import java.util.Optional;
/**
* An exception thrown when something about the proto is malformed. e.g. one of the fields has an invalid value.
*/
public final class InvalidMessageStructureException extends Exception {
private final Optional sender;
private final Optional device;
public InvalidMessageStructureException(String message) {
super(message);
this.sender = Optional.empty();
this.device = Optional.empty();
}
public InvalidMessageStructureException(String message, String sender, int device) {
super(message);
this.sender = Optional.ofNullable(sender);
this.device = Optional.of(device);
}
public InvalidMessageStructureException(Exception e, String sender, int device) {
super(e);
this.sender = Optional.ofNullable(sender);
this.device = Optional.of(device);
}
public InvalidMessageStructureException(Exception e) {
super(e);
this.sender = Optional.empty();
this.device = Optional.empty();
}
public Optional getSender() {
return sender;
}
public Optional getDevice() {
return device;
}
}