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
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()throwsNullPointerException, 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)andtpb.getValue(CONSISTENCY)are unboxed directly toboolean. These are BOOLEAN-format TPB flags:FirebirdParameterBuffer.parseValue()storestrueonly when the flag is present, otherwise the key is absent andgetValuereturnsnull, causing an unboxing NPE. The sibling checks (READ_COMMITTEDline 67,isAutoCommitline 49,isReadOnlyline 58) already guard withnull !=; 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()callspacket.getIsolationLevel()and the NPE is raised.Example codes for reproduce this issue (such as a github link).
N/A