This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 27d5353f53a Fix possible CCE PostgreSQLInt2BinaryProtocolValue (#23865)
27d5353f53a is described below
commit 27d5353f53acd60b889a03e634de94d06f3da283
Author: 吴伟杰 <[email protected]>
AuthorDate: Wed Feb 1 09:31:19 2023 +0800
Fix possible CCE PostgreSQLInt2BinaryProtocolValue (#23865)
* Fix possible CCE PostgreSQLInt2BinaryProtocolValue
* Revise PostgreSQLInt2BinaryProtocolValueTest
* Enable AdditionalDQLE2EIT for PostgreSQL/openGauss
* Revert "Enable AdditionalDQLE2EIT for PostgreSQL/openGauss"
This reverts commit 00d40a9860671a12b8fd14e62424e88368ab7d77.
---
.../query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java | 2 +-
.../extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
index 9f09c14eded..94562b52822 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValue.java
@@ -36,6 +36,6 @@ public final class PostgreSQLInt2BinaryProtocolValue
implements PostgreSQLBinary
@Override
public void write(final PostgreSQLPacketPayload payload, final Object
value) {
- payload.writeInt2((Integer) value);
+ payload.writeInt2(((Number) value).intValue());
}
}
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
index f60c3c5059c..acc1bfea012 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLInt2BinaryProtocolValueTest.java
@@ -48,7 +48,7 @@ public final class PostgreSQLInt2BinaryProtocolValueTest {
byte[] actualData = new byte[6];
PostgreSQLPacketPayload payload = new
PostgreSQLPacketPayload(Unpooled.wrappedBuffer(actualData).writerIndex(0),
StandardCharsets.UTF_8);
PostgreSQLInt2BinaryProtocolValue actual = new
PostgreSQLInt2BinaryProtocolValue();
- actual.write(payload, (int) Short.MIN_VALUE);
+ actual.write(payload, Short.MIN_VALUE);
actual.write(payload, -1);
actual.write(payload, (int) Short.MAX_VALUE);
assertThat(actualData, is(new byte[]{(byte) 0x80, (byte) 0x00, (byte)
0xFF, (byte) 0xFF, (byte) 0x7F, (byte) 0xFF}));