This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 2105874 fixes PostgreSQL SQLXML data type packet exception. (#10084)
2105874 is described below
commit 2105874536ee209adc33bd1382b86434bd418a39
Author: Zonglei Dong <[email protected]>
AuthorDate: Wed Apr 14 22:49:34 2021 +0800
fixes PostgreSQL SQLXML data type packet exception. (#10084)
* fixes PostgreSQL SQLXML data type packet exception.
* fixes PostgreSQL SQLXML data type packet exception test case.
* fixes PostgreSQL SQLXML data type packet exception,
ShardingSphereException -> RuntimeException.
* fixes code conflict.
* fixes code style.
Co-authored-by: Zonglei Dong <[email protected]>
---
.../postgresql/packet/command/query/text/PostgreSQLDataRowPacket.java | 4 +---
.../packet/command/query/text/PostgreSQLDataRowPacketTest.java | 2 +-
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacket.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacket.java
index 42d47b9..f48e004 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacket.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacket.java
@@ -19,7 +19,6 @@ package
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.te
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierPacket;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
import
org.apache.shardingsphere.db.protocol.postgresql.packet.identifier.PostgreSQLMessagePacketType;
@@ -34,7 +33,6 @@ import java.util.Collection;
*/
@RequiredArgsConstructor
@Getter
-@Slf4j
public final class PostgreSQLDataRowPacket implements
PostgreSQLIdentifierPacket {
private final Collection<Object> data;
@@ -65,7 +63,7 @@ public final class PostgreSQLDataRowPacket implements
PostgreSQLIdentifierPacket
payload.writeInt4(((SQLXML) data).getString().getBytes().length);
payload.writeStringEOF(((SQLXML) data).getString());
} catch (final SQLException ex) {
- log.error("PostgreSQL DataRowPacket write SQLXML type exception",
ex);
+ throw new RuntimeException(ex.getMessage());
}
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacketTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacketTest.java
index a93aef0..76a7aa2 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacketTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/text/PostgreSQLDataRowPacketTest.java
@@ -76,7 +76,7 @@ public final class PostgreSQLDataRowPacketTest {
verify(payload).writeStringEOF("value");
}
- @Test
+ @Test(expected = RuntimeException.class)
public void assertWriteWithSQLXML4Error() throws SQLException {
when(sqlxml.getString()).thenThrow(new SQLException("mock"));
PostgreSQLDataRowPacket actual = new
PostgreSQLDataRowPacket(Collections.singletonList(sqlxml));