@Override public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) { throw new AuthenticationException( host, String.format( "Host %s requires authentication, but no authenticator found in Cluster configuration", host)); } };
@Override public DriverException copy() { return new AuthenticationException(address, getMessage(), this); } }
authenticator); incrementAuthErrorMetric(); throw new AuthenticationException(address, message); default: throw new TransportException(
@Override public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) { throw new AuthenticationException(host, String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host)); } };
@Override public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) { throw new AuthenticationException(host, String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host)); } };
@Override public Authenticator newAuthenticator(InetSocketAddress host, String authenticator) { throw new AuthenticationException(host, String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host)); } };
public Authenticator newAuthenticator(InetSocketAddress host) { throw new AuthenticationException(host, String.format("Host %s requires authentication, but no authenticator found in Cluster configuration", host)); } };
@Override public DriverException copy() { return new AuthenticationException(address, getMessage(), this); } }
@Override public DriverException copy() { return new AuthenticationException(address, getMessage(), this); } }
@Override public DriverException copy() { return new AuthenticationException(address, getMessage(), this); } }
@Override public DriverException copy() { return new AuthenticationException(getMessage(), this, address); } }
return new ProtocolError(host, message); case BAD_CREDENTIALS: return new AuthenticationException(host, message); case UNAVAILABLE: return ((UnavailableException) infos).copy(host); // We copy to have a nice stack trace
+ "only plain text authentication is supported with this protocol version", authenticator); incrementAuthErrorMetric(); throw new AuthenticationException(address, message); default: throw new TransportException(address, String.format("Unexpected %s response message from server to authentication message", authResponse.type));
+ "only plain text authentication is supported with this protocol version", authenticator); incrementAuthErrorMetric(); throw new AuthenticationException(address, message); default: throw new TransportException(address, String.format("Unexpected %s response message from server to authentication message", authResponse.type));
+ "only plain text authentication is supported with this protocol version", authenticator); incrementAuthErrorMetric(); throw new AuthenticationException(address, message); default: throw new TransportException(address, String.format("Unexpected %s response message from server to authentication message", authResponse.type));
private void authenticateV1(Authenticator authenticator) throws ConnectionException, BusyConnectionException, ExecutionException, InterruptedException { Requests.Credentials creds = new Requests.Credentials(((ProtocolV1Authenticator)authenticator).getCredentials()); Message.Response authResponse = write(creds).get(); switch (authResponse.type) { case READY: break; case ERROR: throw new AuthenticationException(address, ((Responses.Error)authResponse).message); default: throw defunct(new TransportException(address, String.format("Unexpected %s response message from server to a CREDENTIALS message", authResponse.type))); } }
message = String.format("Cannot use authenticator %s with protocol version 1, " + "only plain text authentication is supported with this protocol version", authenticator); throw new AuthenticationException(address, message); default: throw new TransportException(address, String.format("Unexpected %s response message from server to authentication message", authResponse.type));
public DriverException asException(InetSocketAddress host) { switch (code) { case SERVER_ERROR: return new DriverInternalError(String.format("An unexpected error occurred server side on %s: %s", host, message)); case PROTOCOL_ERROR: return new DriverInternalError("An unexpected protocol error occurred. This is a bug in this library, please report: " + message); case BAD_CREDENTIALS: return new AuthenticationException(host, message); case UNAVAILABLE: return ((UnavailableException)infos).copy(); // We copy to have a nice stack trace case OVERLOADED: return new DriverInternalError(String.format("Queried host (%s) was overloaded; this shouldn't happen, another node should have been tried", host)); case IS_BOOTSTRAPPING: return new DriverInternalError(String.format("Queried host (%s) was bootstrapping; this shouldn't happen, another node should have been tried", host)); case TRUNCATE_ERROR: return new TruncateException(message); case WRITE_TIMEOUT: return ((WriteTimeoutException)infos).copy(); case READ_TIMEOUT: return ((ReadTimeoutException)infos).copy(); case SYNTAX_ERROR: return new SyntaxError(message); case UNAUTHORIZED: return new UnauthorizedException(message); case INVALID: return new InvalidQueryException(message); case CONFIG_ERROR: return new InvalidConfigurationInQueryException(message); case ALREADY_EXISTS: return ((AlreadyExistsException)infos).copy(); case UNPREPARED: return new DriverInternalError(String.format("A prepared query was submitted on %s but was not known of that node; this shouldn't happen, the query should have been re-prepared", host)); default: return new DriverInternalError(String.format("Unknown protocol error code %s returned by %s. The error message was: %s", code, host, message)); } }
return new ProtocolError(host, message); case BAD_CREDENTIALS: return new AuthenticationException(host, message); case UNAVAILABLE: return ((UnavailableException) infos).copy(host); // We copy to have a nice stack trace
return new ProtocolError(host, message); case BAD_CREDENTIALS: return new AuthenticationException(host, message); case UNAVAILABLE: return ((UnavailableException) infos).copy(host); // We copy to have a nice stack trace