Class ChecksumFailureException

All Implemented Interfaces:
Serializable

Thrown in case of a checksum failure during an artifact/metadata download. This exception is usually thrown in following cases: It is resolver expectation to provide most available information to caller.
See Also:
  • Constructor Details

    • ChecksumFailureException

      @Deprecated public ChecksumFailureException(String expected, String expectedKind, String actual)
      Deprecated.
      Use mismatch(String, String, String) or other suitable helper method instead.
      Creates a new exception with the specified expected, expected kind and actual checksum. The resulting exception is retry-worthy.
      Parameters:
      expected - The expected checksum as declared by the hosting repository, may be null.
      expectedKind - The expected checksum kind, may be null.
      actual - The actual checksum as computed from the local bytes, may be null.
      Since:
      1.8.0
    • ChecksumFailureException

      Deprecated.
      Use noneAvailable(String, String) or other suitable helper method instead.
      Creates a new exception with the specified detail message. The resulting exception is not retry-worthy. Use this constructor ONLY in cases like "no data to work with", like missing checksums. In every other case use some other constructor.
      Parameters:
      message - The detail message, may be null.
    • ChecksumFailureException

      Deprecated.
      Use processingFailure(String, Throwable) or other helper method instead.
      Creates a new exception with the specified cause. The resulting exception is not retry-worthy. Use this constructor in case some other error (ie IO problem) prevented checksum calculation.
      Parameters:
      cause - The exception that caused this one, may be null.
    • ChecksumFailureException

      Deprecated.
      Use processingFailure(String, Throwable) or other helper method instead.
      Creates a new exception with the specified detail message and cause. The resulting exception is not retry-worthy. Use this constructor in case some other error (ie IO problem) prevented checksum calculation.
      Parameters:
      message - The detail message, may be null.
      cause - The exception that caused this one, may be null.
    • ChecksumFailureException

      @Deprecated public ChecksumFailureException(boolean retryWorthy, String message, Throwable cause)
      Deprecated.
      Do not use this constructor, it lacks information.
      Creates a new exception with the specified retry flag, detail message and cause.
      Parameters:
      retryWorthy - true if the exception is retry-worthy, false otherwise.
      message - The detail message, may be null.
      cause - The exception that caused this one, may be null.
  • Method Details

    • mismatch

      public static ChecksumFailureException mismatch(String expected, String expectedKind, String actual)
      Use in case of checksum mismatch. Creates a new exception with the specified expected, expected kind and actual checksum. The resulting exception is retry-worthy. The checksum match check should have already happened, this method does not check for any kind of inequality.
      Parameters:
      expected - The expected checksum as declared by the hosting repository, may be null.
      expectedKind - The expected checksum kind, may be null.
      actual - The actual checksum as computed from the local bytes, may be null.
      Since:
      2.0.19
    • mismatchDetail

      public static ChecksumFailureException mismatchDetail(String detail, String expected, String expectedKind, String actual)
      Use in case of checksum mismatch. Creates a new exception with the specified expected, expected kind and actual checksum. The resulting exception is retry-worthy. The checksum match check should have already happened, this method does not check for any kind of inequality.
      Parameters:
      detail - The extra detail/information regarding mismatch.
      expected - The expected checksum as declared by the hosting repository, may be null.
      expectedKind - The expected checksum kind, may be null.
      actual - The actual checksum as computed from the local bytes, may be null.
      Since:
      2.0.19
    • noneAvailable

      public static ChecksumFailureException noneAvailable(String message, String expectedKind)
      Use in case of checksum not available. Optionally, one can specify which kind was not available.
      Parameters:
      message - The message.
      expectedKind - The expected checksum kind, may be null.
      Since:
      2.0.19
    • processingFailure

      Use in case of error, for example IO problem during checksum processing, calculation and alike. Ideally, one should specify cause as well.
      Parameters:
      message - The message.
      cause - The cause.
      Since:
      2.0.19
    • getExpected

      public String getExpected()
      Gets the expected checksum for the downloaded artifact/metadata.
      Returns:
      The expected checksum as declared by the hosting repository or null if unknown.
    • getExpectedKind

      Gets the expected checksum kind for the downloaded artifact/metadata.
      Returns:
      The expected checksum kind or null if unknown.
      Since:
      1.8.0
    • getActual

      public String getActual()
      Gets the actual checksum for the downloaded artifact/metadata.
      Returns:
      The actual checksum as computed from the local bytes or null if unknown.
    • isRetryWorthy

      public boolean isRetryWorthy()
      Indicates whether the corresponding download is retry-worthy.
      Returns:
      true if retrying the download might solve the checksum failure, false if the checksum failure is non-recoverable.