Skip to content

NullPointerException in Firebird transaction isolation resolution when concurrency flag is absent #39133

Description

@thswlsqls

Bug Report

Which version of ShardingSphere did you use?

master @ 7568693

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

Proxy

Expected behavior

Starting a Firebird transaction whose transaction parameter buffer selects SERIALIZABLE (consistency) isolation, or carries no isolation flag, resolves the isolation level and starts the transaction.

Actual behavior

FirebirdStartTransactionPacket.getIsolationLevel() throws NullPointerException, so every start-transaction request that is not concurrency/read-committed fails.

Reason analyze (If you can)

In FirebirdStartTransactionPacket.getIsolationLevel() (database/protocol/dialect/firebird/.../transaction/FirebirdStartTransactionPacket.java, lines 70 and 73), tpb.getValue(CONCURRENCY) and tpb.getValue(CONSISTENCY) are unboxed directly to boolean. These are BOOLEAN-format TPB flags: FirebirdParameterBuffer.parseValue() stores true only when the flag is present, otherwise the key is absent and getValue returns null, causing an unboxing NPE. The sibling checks (READ_COMMITTED line 67, isAutoCommit line 49, isReadOnly line 58) already guard with null !=; these two lines should do the same.

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Start a Firebird transaction with a consistency-only TPB (SERIALIZABLE), or with no isolation flag. FirebirdStartTransactionCommandExecutor.execute() calls packet.getIsolationLevel() and the NPE is raised.

Example codes for reproduce this issue (such as a github link).

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions