This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 081b007d020 Refactor PostgreSQLErrorPacketFactory (#28129)
081b007d020 is described below
commit 081b007d0204255c6b504a4da283c3d7b361cfac
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Aug 16 23:57:37 2023 +0800
Refactor PostgreSQLErrorPacketFactory (#28129)
* Refactor PostgreSQLErrorPacketFactory
* Refactor PostgreSQLErrorPacketFactory
* Refactor PostgreSQLErrorPacketFactory
---
.../proxy/frontend/mysql/err/MySQLErrorPacketFactory.java | 2 +-
.../frontend/postgresql/err/PostgreSQLErrorPacketFactory.java | 7 ++-----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrorPacketFactory.java
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrorPacketFactory.java
index f70b6a99424..e6c0b1d2c21 100644
---
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrorPacketFactory.java
+++
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrorPacketFactory.java
@@ -35,7 +35,7 @@ import java.sql.SQLException;
public final class MySQLErrorPacketFactory {
/**
- * Create new instance of MySQL ERR packet.
+ * Create new instance of MySQL error packet.
*
* @param cause cause
* @return created instance
diff --git
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrorPacketFactory.java
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrorPacketFactory.java
index 90738de972b..a0c77958f64 100644
---
a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrorPacketFactory.java
+++
b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/err/PostgreSQLErrorPacketFactory.java
@@ -41,12 +41,11 @@ import java.sql.SQLException;
public final class PostgreSQLErrorPacketFactory {
/**
- * Create new instance of PostgreSQL ERR packet.
+ * Create new instance of PostgreSQL error packet.
*
* @param cause cause
* @return created instance
*/
- @SuppressWarnings("ConstantConditions")
public static PostgreSQLErrorResponsePacket newInstance(final Exception
cause) {
if (cause instanceof PSQLException && null != ((PSQLException)
cause).getServerErrorMessage()) {
return createErrorResponsePacket(((PSQLException)
cause).getServerErrorMessage());
@@ -59,8 +58,7 @@ public final class PostgreSQLErrorPacketFactory {
}
private static PostgreSQLErrorResponsePacket
createErrorResponsePacket(final PostgreSQLException.ServerErrorMessage
serverErrorMessage) {
- return
PostgreSQLErrorResponsePacket.newBuilder(serverErrorMessage.getSeverity(),
serverErrorMessage.getSqlState(), serverErrorMessage.getMessage())
- .build();
+ return
PostgreSQLErrorResponsePacket.newBuilder(serverErrorMessage.getSeverity(),
serverErrorMessage.getSqlState(), serverErrorMessage.getMessage()).build();
}
private static PostgreSQLErrorResponsePacket
createErrorResponsePacket(final ServerErrorMessage serverErrorMessage) {
@@ -71,7 +69,6 @@ public final class PostgreSQLErrorPacketFactory {
.constraintName(serverErrorMessage.getConstraint()).file(serverErrorMessage.getFile()).line(serverErrorMessage.getLine()).routine(serverErrorMessage.getRoutine()).build();
}
- @SuppressWarnings("ConstantConditions")
private static PostgreSQLErrorResponsePacket
createErrorResponsePacket(final SQLException cause) {
if (cause instanceof PostgreSQLException && null !=
((PostgreSQLException) cause).getServerErrorMessage()) {
return createErrorResponsePacket(((PostgreSQLException)
cause).getServerErrorMessage());