You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/08/03 06:11:31 UTC

[GitHub] [shardingsphere] tristaZero commented on a change in pull request #6584: fix sqlException.getCause isNull

tristaZero commented on a change in pull request #6584:
URL: https://github.com/apache/shardingsphere/pull/6584#discussion_r464211450



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/MySQLErrPacketFactory.java
##########
@@ -47,7 +47,7 @@ public static MySQLErrPacket newInstance(final int sequenceId, final Exception c
         if (cause instanceof SQLException) {
             SQLException sqlException = (SQLException) cause;
             return null != sqlException.getSQLState() ? new MySQLErrPacket(sequenceId, sqlException.getErrorCode(), sqlException.getSQLState(), sqlException.getMessage())
-                : new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_INTERNAL_ERROR, sqlException.getCause().getMessage());
+                : new MySQLErrPacket(sequenceId, MySQLServerErrorCode.ER_INTERNAL_ERROR, cause.getMessage());

Review comment:
       When `null == sqlException.getSQLState() `, `null == sqlException.getCause()` but `cause.getMessage()` could run well, right?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org