private BackgroundException handle(final FTPException e, final StringBuilder buffer) { final int status = e.getCode(); switch(status) { case FTPReply.INSUFFICIENT_STORAGE: case FTPReply.STORAGE_ALLOCATION_EXCEEDED: return new QuotaException(buffer.toString(), e); case FTPReply.NOT_LOGGED_IN: return new LoginFailureException(buffer.toString(), e); case FTPReply.FAILED_SECURITY_CHECK: case FTPReply.DENIED_FOR_POLICY_REASONS: case FTPReply.NEED_ACCOUNT: case FTPReply.NEED_ACCOUNT_FOR_STORING_FILES: case FTPReply.FILE_NAME_NOT_ALLOWED: case FTPReply.FILE_ACTION_NOT_TAKEN: case FTPReply.ACTION_ABORTED: return new AccessDeniedException(buffer.toString(), e); case FTPReply.UNAVAILABLE_RESOURCE: case FTPReply.FILE_UNAVAILABLE: // Requested action not taken. File unavailable (e.g., file not found, no access) return new NotfoundException(buffer.toString(), e); case FTPReply.SERVICE_NOT_AVAILABLE: return new ConnectionRefusedException(buffer.toString(), e); } return new InteroperabilityException(buffer.toString(), e); } }
case HttpStatus.SC_INSUFFICIENT_STORAGE: case HttpStatus.SC_PAYMENT_REQUIRED: return new QuotaException(buffer.toString(), failure); case HttpStatus.SC_UNPROCESSABLE_ENTITY: case HttpStatus.SC_BAD_REQUEST:
|| "storage_cap_exceeded".equalsIgnoreCase(e.getCode()) || "transaction_cap_exceeded".equalsIgnoreCase(e.getCode())) {// Reached the storage cap that you set return new QuotaException(buffer.toString(), e); return new QuotaException(buffer.toString(), e); return new QuotaException(buffer.toString(), e);
return new AccessDeniedException(buffer.toString(), failure); case INSUFFICIENT_SPACE: return new QuotaException(buffer.toString(), failure); return new AccessDeniedException(buffer.toString(), failure); case INSUFFICIENT_SPACE: return new QuotaException(buffer.toString(), failure); case MALFORMED_PATH: case OTHER: return new AccessDeniedException(buffer.toString(), failure); case INSUFFICIENT_SPACE: return new QuotaException(buffer.toString(), failure);