Class AlreadyExistsException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.datastax.driver.core.exceptions.DriverException
-
- com.datastax.driver.core.exceptions.QueryValidationException
-
- com.datastax.driver.core.exceptions.AlreadyExistsException
-
- All Implemented Interfaces:
CoordinatorException,Serializable
public class AlreadyExistsException extends QueryValidationException implements CoordinatorException
Exception thrown when a query attempts to create a keyspace or table that already exists.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description AlreadyExistsException(EndPoint endPoint, String keyspace, String table)AlreadyExistsException(String keyspace, String table)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description DriverExceptioncopy()Copy the exception.AlreadyExistsExceptioncopy(EndPoint endPoint)Create a copy of this exception with a nicer stack trace, and including the coordinator address that caused this exception to be raised.InetSocketAddressgetAddress()Deprecated.EndPointgetEndPoint()The connection information of the coordinator host that was contacted.InetAddressgetHost()Deprecated.StringgetKeyspace()The name of keyspace that either already exists or is home to the table that already exists.StringgetTable()If the failed creation was a table creation, the name of the table that already exists.booleanwasTableCreation()Returns whether the query yielding this exception was a table creation attempt.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Method Detail
-
getEndPoint
public EndPoint getEndPoint()
Description copied from interface:CoordinatorExceptionThe connection information of the coordinator host that was contacted. May benullif the coordinator is not known.- Specified by:
getEndPointin interfaceCoordinatorException
-
getAddress
@Deprecated public InetSocketAddress getAddress()
Deprecated.Description copied from interface:CoordinatorExceptionThe full address of the coordinator host that was contacted; may benullif the coordinator is not known.- Specified by:
getAddressin interfaceCoordinatorException
-
getHost
@Deprecated public InetAddress getHost()
Deprecated.Description copied from interface:CoordinatorExceptionThe coordinator host that was contacted; may benullif the coordinator is not known.- Specified by:
getHostin interfaceCoordinatorException
-
wasTableCreation
public boolean wasTableCreation()
Returns whether the query yielding this exception was a table creation attempt.- Returns:
trueif this exception is raised following a table creation attempt,falseif it was a keyspace creation attempt.
-
getKeyspace
public String getKeyspace()
The name of keyspace that either already exists or is home to the table that already exists.- Returns:
- a keyspace name that is either the keyspace whose creation attempt failed because a
keyspace of the same name already exists (in that case,
tablewill returnnull), or the keyspace of the table creation attempt (in which casetablewill return the name of said table).
-
getTable
public String getTable()
If the failed creation was a table creation, the name of the table that already exists.- Returns:
- the name of table whose creation attempt failed because a table of this name already
exists, or
nullif the query was a keyspace creation query.
-
copy
public DriverException copy()
Description copied from class:DriverExceptionCopy the exception.This returns a new exception, equivalent to the original one, except that because a new object is created in the current thread, the top-most element in the stacktrace of the exception will refer to the current thread (this is mainly intended for internal use by the driver). The cause of the copied exception will be the original exception.
- Overrides:
copyin classDriverException- Returns:
- a copy/clone of this exception.
-
copy
public AlreadyExistsException copy(EndPoint endPoint)
Create a copy of this exception with a nicer stack trace, and including the coordinator address that caused this exception to be raised.This method is mainly intended for internal use by the driver and exists mainly because:
- the original exception was decoded from a response frame and at that time, the coordinator address was not available; and
- the newly-created exception will refer to the current thread in its stack trace, which generally yields a more user-friendly stack trace that the original one.
- Parameters:
endPoint- The full address of the host that caused this exception to be thrown.- Returns:
- a copy/clone of this exception, but with the given host address instead of the original one.
-
-