Class StaleSidecarException

All Implemented Interfaces:
Serializable

public final class StaleSidecarException extends AnkaSecureSdkException
Thrown when a streaming / atomic file-output operation cannot create its quarantine sidecar (<destination>.part) because a file already exists at the sidecar path — the signature of a stale sidecar orphaned by a prior crashed or force-killed operation (the CREATE_NEW sidecar is normally deleted on BOTH the success and the fail-closed paths, so a surviving one indicates an earlier abnormal termination).

Without this translation the collision surfaces as an opaque FileAlreadyExistsException that names the .part path with no context, and can be swallowed into a generically-translated I/O error at the service boundary — so every future write to that destination fails with no actionable explanation.

Under FAIL_IF_EXISTS (the default) the SDK refuses to touch the pre-existing sidecar and raises this typed exception, which NAMES the exact .part file to remove and states the remediation. Under OVERWRITE the stale sidecar is reclaimed (deleted) automatically before the write and this exception is never thrown.

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

Since:
3.0.0
See Also:
  • Constructor Details

    • StaleSidecarException

      public StaleSidecarException(Path sidecar, Path destination, Throwable cause)
      Constructs a new stale-sidecar exception.
      Parameters:
      sidecar - the pre-existing <destination>.part path (may be null)
      destination - the final destination the blocked write targeted (may be null)
      cause - the underlying FileAlreadyExistsException (may be null)
  • Method Details

    • getSidecar

      public Path getSidecar()
      Returns the stale sidecar path that blocked the write.
      Returns:
      the .part path, or null when unknown
    • getDestination

      public Path getDestination()
      Returns the final destination the blocked write targeted.
      Returns:
      the destination path, or null when unknown