Package com.datastax.driver.core.exceptions

Examples of com.datastax.driver.core.exceptions.DriverInternalError


            cb.readerIndex(cb.readerIndex() + length);
            return str;
        } catch (IllegalStateException e) {
            // That's the way netty encapsulate a CCE
            if (e.getCause() instanceof CharacterCodingException)
                throw new DriverInternalError("Cannot decode string as UTF8");
            else
                throw e;
        }
    }
View Full Code Here


    public static String readString(ChannelBuffer cb) {
        try {
            int length = cb.readUnsignedShort();
            return readString(cb, length);
        } catch (IndexOutOfBoundsException e) {
            throw new DriverInternalError("Not enough bytes to read an UTF8 serialized string preceded by it's 2 bytes length");
        }
    }
View Full Code Here

    public static String readLongString(ChannelBuffer cb) {
        try {
            int length = cb.readInt();
            return readString(cb, length);
        } catch (IndexOutOfBoundsException e) {
            throw new DriverInternalError("Not enough bytes to read an UTF8 serialized string preceded by it's 4 bytes length");
        }
    }
View Full Code Here

            int length = cb.readUnsignedShort();
            byte[] bytes = new byte[length];
            cb.readBytes(bytes);
            return bytes;
        } catch (IndexOutOfBoundsException e) {
            throw new DriverInternalError("Not enough bytes to read a byte array preceded by it's 2 bytes length");
        }
    }
View Full Code Here

    public static <T extends Enum<T>> T readEnumValue(Class<T> enumType, ChannelBuffer cb) {
        String value = CBUtil.readString(cb);
        try {
            return Enum.valueOf(enumType, value.toUpperCase());
        } catch (IllegalArgumentException e) {
            throw new DriverInternalError(String.format("Invalid value '%s' for %s", value, enumType.getSimpleName()));
        }
    }
View Full Code Here

        cb.readBytes(address);
        int port = cb.readInt();
        try {
            return new InetSocketAddress(InetAddress.getByAddress(address), port);
        } catch (UnknownHostException e) {
            throw new DriverInternalError(String.format("Invalid IP address (%d.%d.%d.%d) while deserializing inet address", address[0], address[1], address[2], address[3]));
        }
    }
View Full Code Here

                                    MultiPage.this.fetchState = null;
                                } else {
                                    logger.error("Received unknown result type '{}' during paging: ignoring message", rm.kind);
                                    // This mean we have probably have a bad node, so defunct the connection
                                    connection.defunct(new ConnectionException(connection.address, String.format("Got unexpected %s result response", rm.kind)));
                                    future.setException(new DriverInternalError(String.format("Got unexpected %s result response from %s", rm.kind, connection.address)));
                                    return;
                                }

                                MultiPage.this.infos.offer(info);
                                future.set(null);
                                break;
                            case ERROR:
                                future.setException(((Responses.Error)response).asException(connection.address));
                                break;
                            default:
                                // This mean we have probably have a bad node, so defunct the connection
                                connection.defunct(new ConnectionException(connection.address, String.format("Got unexpected %s response", response.type)));
                                future.setException(new DriverInternalError(String.format("Got unexpected %s response from %s", response.type, connection.address)));
                                break;
                        }
                    } catch (RuntimeException e) {
                        // If we get a bug here, the client will not get it, so better forwarding the error
                        future.setException(new DriverInternalError("Unexpected error while processing response from " + connection.address, e));
                    }
                }

                // This is only called for internal calls, so don't bother with ExecutionInfo
                @Override
View Full Code Here

                    break;
                default:
                    throw defunct(new TransportException(address, String.format("Unexpected %s response message from server to a STARTUP message", response.type)));
            }
        } catch (BusyConnectionException e) {
            throw new DriverInternalError("Newly created connection should not be busy");
        } catch (ExecutionException e) {
            throw defunct(new ConnectionException(address, "Unexpected error during transport initialization", e.getCause()));
        }
    }
View Full Code Here

            logger.debug("[Control connection] Refreshing schema");
            refreshSchema(connection, null, null, cluster);
            return connection;
        } catch (BusyConnectionException e) {
            throw new DriverInternalError("Newly created connection should not be busy");
        }
    }
View Full Code Here

                    maybeGetIndex(defs[i].getName(), i, partitionKeyColumns, pkIndexes);
                }

                return new PreparedStatement(new ColumnDefinitions(defs), pmsg.statementId, allSet(pkIndexes) ? pkIndexes : null);
            default:
                throw new DriverInternalError(String.format("%s response received when prepared statement received was expected", msg.kind));
        }
    }
View Full Code Here

TOP

Related Classes of com.datastax.driver.core.exceptions.DriverInternalError

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.