@Override public BackgroundException map(final IOException failure) { if(failure instanceof ConnectionClosedException) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, failure.getMessage()); return new ConnectionRefusedException(buffer.toString(), failure); } return super.map(failure); } }
@Override public BackgroundException map(final SocketException failure) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, failure.getMessage()); if(StringUtils.equals(failure.getMessage(), "Software caused connection abort")) { return new ConnectionCanceledException(buffer.toString(), failure); } if(StringUtils.equals(failure.getMessage(), "Socket closed")) { return new ConnectionCanceledException(buffer.toString(), failure); } return new ConnectionRefusedException(buffer.toString(), failure); } }
@Override public BackgroundException map(final IOException e) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, e.getMessage()); if(e instanceof FTPConnectionClosedException) { return new ConnectionRefusedException(buffer.toString(), e); } if(e instanceof FTPException) { return this.handle((FTPException) e, buffer); } if(e instanceof MalformedServerReplyException) { return new InteroperabilityException(buffer.toString(), e); } return new DefaultIOExceptionMappingService().map(e); }
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); } }
return new ConnectionRefusedException(buffer.toString(), failure); return new ConnectionRefusedException(buffer.toString(), failure);
@Override public BackgroundException map(final ExceptionUDT e) { final StringBuilder buffer = new StringBuilder(); this.append(buffer, e.getError().getDescription()); switch(e.getError()) { case NOSERVER: case ECONNSETUP: case ECONNFAIL: case ECONNLOST: case ECONNREJ: return new ConnectionRefusedException(buffer.toString(), e); case ETIMEOUT: case EINVSOCK: return new ConnectionTimeoutException(buffer.toString(), e); case EWRPERM: return new AccessDeniedException(buffer.toString(), e); case EINVPARAM: return new InteroperabilityException(buffer.toString(), e); case USER_DEFINED_MESSAGE: // Handle UDT Error : -4 : user defined message : UDT send time out [id: 0x3223fa70] case WRAPPER_UNKNOWN: case WRAPPER_UNIMPLEMENTED: case WRAPPER_MESSAGE: return new InteroperabilityException(buffer.toString(), e); } return this.wrap(e, buffer); } }
case NO_CONNECTION: case CONNECITON_LOST: return new ConnectionRefusedException(buffer.toString(), e); return new ConnectionRefusedException(buffer.toString(), e);
public BackgroundException map(final IOException e, final StringBuilder buffer, final DisconnectReason reason) { final String failure = buffer.toString(); if(DisconnectReason.HOST_KEY_NOT_VERIFIABLE.equals(reason)) { log.warn(String.format("Failure verifying host key. %s", failure)); // Host key dismissed by user return new ConnectionCanceledException(e); } if(DisconnectReason.PROTOCOL_ERROR.equals(reason)) { // Too many authentication failures return new InteroperabilityException(failure, e); } if(DisconnectReason.ILLEGAL_USER_NAME.equals(reason)) { return new LoginFailureException(failure, e); } if(DisconnectReason.NO_MORE_AUTH_METHODS_AVAILABLE.equals(reason)) { return new LoginFailureException(failure, e); } if(DisconnectReason.PROTOCOL_VERSION_NOT_SUPPORTED.equals(reason)) { return new InteroperabilityException(failure, e); } if(e instanceof TransportException) { return new ConnectionRefusedException(buffer.toString(), e); } return this.wrap(e, buffer); } }
try { if(null == disconnectListener.getFailure()) { throw new ConnectionRefusedException(LocaleFactory.localizedString("Login failed", "Credentials"), ignored);
return new ConnectionRefusedException(buffer.toString(), failure);