com.mysql.cj.exceptions.FeatureNotAvailableException Java Examples

The following examples show how to use com.mysql.cj.exceptions.FeatureNotAvailableException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XProtocol.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public void negotiateSSLConnection(int packLength) {

        if (!((XServerCapabilities) this.serverSession.getCapabilities()).hasCapability("tls")) {
            throw new CJCommunicationsException("A secure connection is required but the server is not configured with SSL.");
        }

        // the message reader is async and is always "reading". we need to stop it to use the socket for the TLS handshake
        ((AsyncMessageReader) this.reader).stopAfterNextMessage();
        setCapability("tls", true);

        try {
            this.socketConnection.performTlsHandshake(null);
        } catch (SSLParamsException | FeatureNotAvailableException | IOException e) {
            throw new CJCommunicationsException(e);
        }

        // resume message processing
        ((AsyncMessageSender) this.writer).setChannel(this.socketConnection.getAsynchronousSocketChannel());
        ((AsyncMessageReader) this.reader).start();
    }
 
Example #2
Source File: MySQLJDBCReflections.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@BuildStep
void registerExceptionsForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJCommunicationsException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, CJConnectionFeatureNotAvailableException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJTimeoutException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJPacketTooBigException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, AssertionFailedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, CJOperationNotSupportedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ClosedOnExpiredPasswordException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, ConnectionIsClosedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataConversionException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataReadException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DataTruncationException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, DeadlockTimeoutRollbackMarker.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, FeatureNotAvailableException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, InvalidConnectionAttributeException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NumberOutOfRange.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, OperationCancelledException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PasswordExpiredException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, PropertyNotModifiableException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, RSAException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, SSLParamsException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StatementIsClosedException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, StreamingNotifiable.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, UnableToConnectException.class.getName()));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, UnsupportedConnectionStringException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, WrongArgumentException.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(true, true, "com.mysql.cj.jdbc.MysqlXAException"));
    reflectiveClass
            .produce(new ReflectiveClassBuildItem(false, false, StandardLoadBalanceExceptionChecker.class.getName()));
    reflectiveClass.produce(new ReflectiveClassBuildItem(false, false, NdbLoadBalanceExceptionChecker.class.getName()));
}
 
Example #3
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException {
    try {
        MysqlType mt = MysqlType.getByJdbcType(sqlType);
        registerOutParameter(parameterIndex, mt, typeName);
    } catch (FeatureNotAvailableException nae) {
        throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(sqlType),
                MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, getExceptionInterceptor());
    }
}
 
Example #4
Source File: CallableStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {
    try {
        MysqlType mt = MysqlType.getByJdbcType(sqlType);
        registerOutParameter(parameterIndex, mt);
    } catch (FeatureNotAvailableException nae) {
        throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(sqlType),
                MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, getExceptionInterceptor());
    }
}
 
Example #5
Source File: ClientPreparedStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setObject(int parameterIndex, Object parameterObj, int targetSqlType, int scale) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        try {
            ((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj,
                    MysqlType.getByJdbcType(targetSqlType), scale);
        } catch (FeatureNotAvailableException nae) {
            throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetSqlType),
                    MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, this.exceptionInterceptor);
        }
    }
}
 
Example #6
Source File: ClientPreparedStatement.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setObject(int parameterIndex, Object parameterObj, int targetSqlType) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        try {
            ((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj,
                    MysqlType.getByJdbcType(targetSqlType));
        } catch (FeatureNotAvailableException nae) {
            throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetSqlType),
                    MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, this.exceptionInterceptor);
        }
    }
}
 
Example #7
Source File: XProtocol.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
public void negotiateSSLConnection(int packLength) {

        if (!ExportControlled.enabled()) {
            throw new CJConnectionFeatureNotAvailableException();
        }

        if (!((XServerCapabilities) this.serverSession.getCapabilities()).hasCapability("tls")) {
            throw new CJCommunicationsException("A secure connection is required but the server is not configured with SSL.");
        }

        // the message reader is async and is always "reading". we need to stop it to use the socket for the TLS handshake
        this.reader.stopAfterNextMessage();
        setCapability("tls", true);

        try {
            this.socketConnection.performTlsHandshake(null); //(this.serverSession);
        } catch (SSLParamsException | FeatureNotAvailableException | IOException e) {
            throw new CJCommunicationsException(e);
        }

        if (this.socketConnection.isSynchronous()) {
            // i/o streams were replaced, build new packet sender/reader
            this.sender = new SyncMessageSender(this.socketConnection.getMysqlOutput());
            this.reader = new SyncMessageReader(this.socketConnection.getMysqlInput());
        } else {
            // resume message processing
            ((AsyncMessageSender) this.sender).setChannel(this.socketConnection.getAsynchronousSocketChannel());
            this.reader.start();
        }
    }
 
Example #8
Source File: NativeProtocol.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Negotiates the SSL communications channel used when connecting
 * to a MySQL server that understands SSL.
 * 
 * @param packLength
 *            packet length
 */
@Override
public void negotiateSSLConnection(int packLength) {
    if (!ExportControlled.enabled()) {
        throw new CJConnectionFeatureNotAvailableException(this.getPropertySet(), this.serverSession, this.getPacketSentTimeHolder(), null);
    }

    long clientParam = this.serverSession.getClientParam();
    clientParam |= NativeServerSession.CLIENT_SSL;
    this.serverSession.setClientParam(clientParam);

    NativePacketPayload packet = new NativePacketPayload(packLength);
    packet.writeInteger(IntegerDataType.INT4, clientParam);
    packet.writeInteger(IntegerDataType.INT4, NativeConstants.MAX_PACKET_SIZE);
    packet.writeInteger(IntegerDataType.INT1, AuthenticationProvider.getCharsetForHandshake(this.authProvider.getEncodingForHandshake(),
            this.serverSession.getCapabilities().getServerVersion()));
    packet.writeBytes(StringLengthDataType.STRING_FIXED, new byte[23]);  // Set of bytes reserved for future use.

    send(packet, packet.getPosition());

    try {
        this.socketConnection.performTlsHandshake(this.serverSession);
    } catch (FeatureNotAvailableException nae) {
        throw new CJConnectionFeatureNotAvailableException(this.getPropertySet(), this.serverSession, this.getPacketSentTimeHolder(), nae);
    } catch (IOException ioEx) {
        throw ExceptionFactory.createCommunicationsException(this.propertySet, this.serverSession, this.getPacketSentTimeHolder(),
                this.getPacketReceivedTimeHolder(), ioEx, getExceptionInterceptor());
    }
    // i/o streams were replaced, build new packet sender/reader
    this.packetSender = new SimplePacketSender(this.socketConnection.getMysqlOutput());
    this.packetReader = new SimplePacketReader(this.socketConnection, this.maxAllowedPacket);
}
 
Example #9
Source File: NativeProtocol.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public <T extends ProtocolEntity> T read(Class<T> requiredClass, ProtocolEntityFactory<T, NativePacketPayload> protocolEntityFactory) throws IOException {
    @SuppressWarnings("unchecked")
    ProtocolEntityReader<T, NativePacketPayload> sr = (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_TEXT_READER
            .get(requiredClass);
    if (sr == null) {
        throw ExceptionFactory.createException(FeatureNotAvailableException.class, "ProtocolEntityReader isn't available for class " + requiredClass);
    }
    return sr.read(protocolEntityFactory);
}
 
Example #10
Source File: NativeProtocol.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
@Override
public <T extends ProtocolEntity> T read(Class<Resultset> requiredClass, int maxRows, boolean streamResults, NativePacketPayload resultPacket,
        boolean isBinaryEncoded, ColumnDefinition metadata, ProtocolEntityFactory<T, NativePacketPayload> protocolEntityFactory) throws IOException {
    @SuppressWarnings("unchecked")
    ProtocolEntityReader<T, NativePacketPayload> sr = isBinaryEncoded
            ? (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_BINARY_READER.get(requiredClass)
            : (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_TEXT_READER.get(requiredClass);
    if (sr == null) {
        throw ExceptionFactory.createException(FeatureNotAvailableException.class, "ProtocolEntityReader isn't available for class " + requiredClass);
    }
    return sr.read(maxRows, streamResults, resultPacket, metadata, protocolEntityFactory);
}
 
Example #11
Source File: ExportControlled.java    From FoxTelem with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Converts the socket being used in the given CoreIO to an SSLSocket by
 * performing the SSL/TLS handshake.
 * 
 * @param rawSocket
 *            original non-SSL socket
 * @param socketConnection
 *            the Protocol instance containing the socket to convert to an
 *            SSLSocket.
 * @param serverVersion
 *            ServerVersion object
 * @return SSL socket
 * @throws IOException
 *             if i/o exception occurs
 * @throws SSLParamsException
 *             if the handshake fails, or if this distribution of
 *             Connector/J doesn't contain the SSL crypto hooks needed to
 *             perform the handshake.
 * @throws FeatureNotAvailableException
 *             if TLS is not supported
 */
public static Socket performTlsHandshake(Socket rawSocket, SocketConnection socketConnection, ServerVersion serverVersion)
        throws IOException, SSLParamsException, FeatureNotAvailableException {

    PropertySet pset = socketConnection.getPropertySet();

    SslMode sslMode = pset.<SslMode> getEnumProperty(PropertyKey.sslMode).getValue();
    boolean verifyServerCert = sslMode == SslMode.VERIFY_CA || sslMode == SslMode.VERIFY_IDENTITY;

    KeyStoreConf trustStore = !verifyServerCert ? new KeyStoreConf() : getTrustStoreConf(pset, PropertyKey.trustCertificateKeyStoreUrl,
            PropertyKey.trustCertificateKeyStorePassword, PropertyKey.trustCertificateKeyStoreType, verifyServerCert && serverVersion == null);

    KeyStoreConf keyStore = getKeyStoreConf(pset, PropertyKey.clientCertificateKeyStoreUrl, PropertyKey.clientCertificateKeyStorePassword,
            PropertyKey.clientCertificateKeyStoreType);

    SSLSocketFactory socketFactory = getSSLContext(keyStore.keyStoreUrl, keyStore.keyStoreType, keyStore.keyStorePassword, trustStore.keyStoreUrl,
            trustStore.keyStoreType, trustStore.keyStorePassword, serverVersion != null, verifyServerCert,
            sslMode == PropertyDefinitions.SslMode.VERIFY_IDENTITY ? socketConnection.getHost() : null, socketConnection.getExceptionInterceptor())
                    .getSocketFactory();

    SSLSocket sslSocket = (SSLSocket) socketFactory.createSocket(rawSocket, socketConnection.getHost(), socketConnection.getPort(), true);

    sslSocket.setEnabledProtocols(getAllowedProtocols(pset, serverVersion, sslSocket.getSupportedProtocols()));

    String[] allowedCiphers = getAllowedCiphers(pset, serverVersion, sslSocket.getEnabledCipherSuites());
    if (allowedCiphers != null) {
        sslSocket.setEnabledCipherSuites(allowedCiphers);
    }

    sslSocket.startHandshake();

    return sslSocket;
}
 
Example #12
Source File: UpdatableResultSet.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal setObject implementation. Although targetType is not part of default ResultSet methods signatures, it is used for type conversions from
 * JDBC42UpdatableResultSet new JDBC 4.2 updateObject() methods.
 * 
 * @param columnIndex
 * @param x
 * @param targetType
 * @param scaleOrLength
 * @throws SQLException
 */
protected void updateObjectInternal(int columnIndex, Object x, Integer targetType, int scaleOrLength) throws SQLException {
    try {
        MysqlType targetMysqlType = targetType == null ? null : MysqlType.getByJdbcType(targetType);
        updateObjectInternal(columnIndex, x, targetMysqlType, scaleOrLength);

    } catch (FeatureNotAvailableException nae) {
        throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetType),
                MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, getExceptionInterceptor());
    }
}
 
Example #13
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void registerOutParameter(int parameterIndex, int sqlType) throws SQLException {
    try {
        MysqlType mt = MysqlType.getByJdbcType(sqlType);
        registerOutParameter(parameterIndex, mt);
    } catch (FeatureNotAvailableException nae) {
        throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(sqlType),
                MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, getExceptionInterceptor());
    }
}
 
Example #14
Source File: ClientPreparedStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setObject(int parameterIndex, Object parameterObj, int targetSqlType, int scale) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        try {
            ((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj,
                    MysqlType.getByJdbcType(targetSqlType), scale);
        } catch (FeatureNotAvailableException nae) {
            throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetSqlType),
                    MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, this.exceptionInterceptor);
        }
    }
}
 
Example #15
Source File: ClientPreparedStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void setObject(int parameterIndex, Object parameterObj, int targetSqlType) throws SQLException {
    synchronized (checkClosed().getConnectionMutex()) {
        try {
            ((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj,
                    MysqlType.getByJdbcType(targetSqlType));
        } catch (FeatureNotAvailableException nae) {
            throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(targetSqlType),
                    MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, this.exceptionInterceptor);
        }
    }
}
 
Example #16
Source File: NativeProtocol.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public <T extends ProtocolEntity> T read(Class<Resultset> requiredClass, int maxRows, boolean streamResults, NativePacketPayload resultPacket,
        boolean isBinaryEncoded, ColumnDefinition metadata, ProtocolEntityFactory<T, NativePacketPayload> protocolEntityFactory) throws IOException {
    @SuppressWarnings("unchecked")
    ProtocolEntityReader<T, NativePacketPayload> sr = isBinaryEncoded
            ? (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_BINARY_READER.get(requiredClass)
            : (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_TEXT_READER.get(requiredClass);
    if (sr == null) {
        throw ExceptionFactory.createException(FeatureNotAvailableException.class, "ProtocolEntityReader isn't available for class " + requiredClass);
    }
    return sr.read(maxRows, streamResults, resultPacket, metadata, protocolEntityFactory);
}
 
Example #17
Source File: NativeProtocol.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public <T extends ProtocolEntity> T read(Class<T> requiredClass, ProtocolEntityFactory<T, NativePacketPayload> protocolEntityFactory) throws IOException {
    @SuppressWarnings("unchecked")
    ProtocolEntityReader<T, NativePacketPayload> sr = (ProtocolEntityReader<T, NativePacketPayload>) this.PROTOCOL_ENTITY_CLASS_TO_TEXT_READER
            .get(requiredClass);
    if (sr == null) {
        throw ExceptionFactory.createException(FeatureNotAvailableException.class, "ProtocolEntityReader isn't available for class " + requiredClass);
    }
    return sr.read(protocolEntityFactory);
}
 
Example #18
Source File: CallableStatement.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public void registerOutParameter(int parameterIndex, int sqlType, String typeName) throws SQLException {
    try {
        MysqlType mt = MysqlType.getByJdbcType(sqlType);
        registerOutParameter(parameterIndex, mt, typeName);
    } catch (FeatureNotAvailableException nae) {
        throw SQLError.createSQLFeatureNotSupportedException(Messages.getString("Statement.UnsupportedSQLType") + JDBCType.valueOf(sqlType),
                MysqlErrorNumbers.SQL_STATE_DRIVER_NOT_CAPABLE, getExceptionInterceptor());
    }
}
 
Example #19
Source File: NativeProtocol.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Negotiates the SSL communications channel used when connecting
 * to a MySQL server that understands SSL.
 * 
 * @param packLength
 */
@Override
public void negotiateSSLConnection(int packLength) {
    if (!ExportControlled.enabled()) {
        throw new CJConnectionFeatureNotAvailableException(this.getPropertySet(), this.serverSession,
                this.getPacketSentTimeHolder().getLastPacketSentTime(), null);
    }

    long clientParam = this.serverSession.getClientParam();
    clientParam |= NativeServerSession.CLIENT_SSL;
    this.serverSession.setClientParam(clientParam);

    NativePacketPayload packet = new NativePacketPayload(packLength);
    packet.writeInteger(IntegerDataType.INT4, clientParam);
    packet.writeInteger(IntegerDataType.INT4, NativeConstants.MAX_PACKET_SIZE);
    packet.writeInteger(IntegerDataType.INT1, AuthenticationProvider.getCharsetForHandshake(this.authProvider.getEncodingForHandshake(),
            this.serverSession.getCapabilities().getServerVersion()));
    packet.writeBytes(StringLengthDataType.STRING_FIXED, new byte[23]);  // Set of bytes reserved for future use.

    send(packet, packet.getPosition());

    try {
        this.socketConnection.performTlsHandshake(this.serverSession);
    } catch (FeatureNotAvailableException nae) {
        throw new CJConnectionFeatureNotAvailableException(this.getPropertySet(), this.serverSession,
                this.getPacketSentTimeHolder().getLastPacketSentTime(), nae);
    } catch (IOException ioEx) {
        throw ExceptionFactory.createCommunicationsException(this.propertySet, this.serverSession, this.getPacketSentTimeHolder().getLastPacketSentTime(),
                this.getPacketReceivedTimeHolder().getLastPacketReceivedTime(), ioEx, getExceptionInterceptor());
    }
    // i/o streams were replaced, build new packet sender/reader
    this.packetSender = new SimplePacketSender(this.socketConnection.getMysqlOutput());
    this.packetReader = new SimplePacketReader(this.socketConnection, this.maxAllowedPacket);
}
 
Example #20
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<Row> fetchAll() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #21
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Row next() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #22
Source File: SimplePacketReaderTest.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void performTlsHandshake(ServerSession serverSession) throws SSLParamsException, FeatureNotAvailableException, IOException {
    // TODO Auto-generated method stub

}
 
Example #23
Source File: AsyncMessageReaderTest.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void performTlsHandshake(ServerSession serverSession) throws SSLParamsException, FeatureNotAvailableException, IOException {
    // TODO Auto-generated method stub

}
 
Example #24
Source File: SessionTest.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Test
public void sqlUpdate() {
    if (!this.isSetForXTests) {
        return;
    }
    SqlStatement stmt = this.session.sql("set @cjTestVar = 1");
    SqlResult res = stmt.execute();
    assertFalse(res.hasData());
    assertEquals(0, res.getAffectedItemsCount());
    assertEquals(null, res.getAutoIncrementValue());
    assertEquals(0, res.getWarningsCount());
    assertFalse(res.getWarnings().hasNext());

    // TODO SqlUpdateResult throws FeatureNotAvailableException("Not a multi-result");
    //res.nextResult();

    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.fetchAll();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.next();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.hasNext();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.getColumnCount();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.getColumns();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.getColumnNames();
            return null;
        }
    });
    assertThrows(FeatureNotAvailableException.class, "No data", new Callable<Void>() {
        public Void call() throws Exception {
            res.count();
            return null;
        }
    });

}
 
Example #25
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public boolean hasNext() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #26
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public int getColumnCount() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #27
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<Column> getColumns() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #28
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public List<String> getColumnNames() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #29
Source File: SqlUpdateResult.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
@Override
public long count() {
    throw new FeatureNotAvailableException("No data");
}
 
Example #30
Source File: CollectionImpl.java    From FoxTelem with GNU General Public License v3.0 4 votes vote down vote up
public AddStatement add(Map<String, ?> doc) {
    throw new FeatureNotAvailableException("TODO: ");
}