Class DestinationExistsException

All Implemented Interfaces:
Serializable

public final class DestinationExistsException extends AnkaSecureSdkException
Thrown when a file-output operation cannot commit its result because a file already exists at the destination and FAIL_IF_EXISTS (the default) is in effect.

This is distinct from StreamIntegrityException: it signals a destination-collision refusal, NOT an integrity failure. In every case the sidecar (<destination>.part) has already been deleted and the pre-existing destination is left byte-for-byte untouched — the atomic rename itself is the TOCTOU race guard, so a destination that appears between the writability preflight and the promotion is never clobbered.

To overwrite intentionally, derive an overwrite-enabled instance with AuthenticatedSdk.withOverwrite() (or withOverwritePolicy(OverwritePolicy.OVERWRITE)).

Extends AnkaSecureSdkException (the SDK's documented exception base) so it is caught by a uniform catch (AnkaSecureSdkException e); being a client-side collision it carries no HTTP status/body (AnkaSecureSdkException.getHttpStatus() is 0).

Since:
3.0.0
See Also:
  • Constructor Details

    • DestinationExistsException

      public DestinationExistsException(Path destination, Throwable cause)
      Constructs a new destination-collision exception.
      Parameters:
      destination - the destination path that already exists (may be null)
      cause - the underlying FileAlreadyExistsException (may be null)
  • Method Details

    • getDestination

      public Path getDestination()
      Returns the destination path that already exists.
      Returns:
      the destination path, or null when unknown