@Override public Response toResponse(final InsufficientStorageException e) { LOGGER.error("InsufficientStorageException intercepted by {}: {}\n", getClass().getSimpleName(), e.getMessage()); debugException(this, e, LOGGER); return status(INSUFFICIENT_STORAGE_HTTP_CODE).entity(e.getMessage()).type(TEXT_PLAIN_WITH_CHARSET).build(); } }
/** * @param rootThrowable The original throwable * @param throwable The throwable under direct scrutiny. */ @Override protected void checkForInsufficientStorageException(final Throwable rootThrowable, final Throwable throwable) throws InvalidChecksumException { final String message = throwable.getMessage(); if (throwable instanceof IOException && message != null && message.contains( INSUFFICIENT_SPACE_IDENTIFYING_MESSAGE)) { throw new InsufficientStorageException(throwable.getMessage(), rootThrowable); } if (throwable.getCause() != null) { checkForInsufficientStorageException(rootThrowable, throwable.getCause()); } if (rootThrowable instanceof InvalidChecksumException) { throw (InvalidChecksumException) rootThrowable; } else if (rootThrowable instanceof RuntimeException) { throw (RuntimeException) rootThrowable; } else { throw new RepositoryRuntimeException(rootThrowable); } }
/** * @param rootThrowable The original throwable * @param throwable The throwable under direct scrutiny. * @throws InvalidChecksumException in case there was a checksum mismatch */ protected void checkForInsufficientStorageException(final Throwable rootThrowable, final Throwable throwable) throws InvalidChecksumException { final String message = throwable.getMessage(); if (throwable instanceof IOException && message != null && message.contains( INSUFFICIENT_SPACE_IDENTIFYING_MESSAGE)) { throw new InsufficientStorageException(throwable.getMessage(), rootThrowable); } if (throwable.getCause() != null) { checkForInsufficientStorageException(rootThrowable, throwable.getCause()); } if (rootThrowable instanceof InvalidChecksumException) { throw (InvalidChecksumException) rootThrowable; } else if (rootThrowable instanceof RuntimeException) { throw (RuntimeException) rootThrowable; } else { throw new RepositoryRuntimeException(rootThrowable); } } }