All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.api.InvalidMessageStructureException Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
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;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy