You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2025/02/20 05:01:50 UTC

(shardingsphere) branch master updated: Correct the cause exception in SingleTablesLoadingException. (#34728)

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 1f98d4e433e Correct the cause exception in SingleTablesLoadingException. (#34728)
1f98d4e433e is described below

commit 1f98d4e433e0cbbebc333d657c6baf9427052b4f
Author: Cong Hu <ia...@gmail.com>
AuthorDate: Thu Feb 20 13:01:44 2025 +0800

    Correct the cause exception in SingleTablesLoadingException. (#34728)
---
 .../shardingsphere/single/exception/SingleDefinitionException.java    | 4 ++++
 .../shardingsphere/single/exception/SingleTablesLoadingException.java | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleDefinitionException.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleDefinitionException.java
index c7e774e5a9a..f0ec595ce76 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleDefinitionException.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleDefinitionException.java
@@ -34,6 +34,10 @@ public abstract class SingleDefinitionException extends MetaDataSQLException {
         super(sqlState, getErrorCode(errorCode), reason, messageArgs);
     }
     
+    protected SingleDefinitionException(final SQLState sqlState, final int errorCode, final Exception cause, final String reason, final Object... messageArgs) {
+        super(sqlState, getErrorCode(errorCode), cause, reason, messageArgs);
+    }
+    
     private static int getErrorCode(final int errorCode) {
         Preconditions.checkArgument(errorCode >= 0 && errorCode < 100, "The value range of error code should be [0, 100).");
         return SINGLE_CODE * 100 + errorCode;
diff --git a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleTablesLoadingException.java b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleTablesLoadingException.java
index e46fc9a22f4..dd62e378f65 100644
--- a/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleTablesLoadingException.java
+++ b/kernel/single/core/src/main/java/org/apache/shardingsphere/single/exception/SingleTablesLoadingException.java
@@ -29,6 +29,6 @@ public final class SingleTablesLoadingException extends SingleDefinitionExceptio
     private static final long serialVersionUID = 698261896187918188L;
     
     public SingleTablesLoadingException(final String databaseName, final String dataSourceName, final SQLException cause) {
-        super(XOpenSQLState.GENERAL_ERROR, 2, String.format("Can not load table with database name '%s' and data source name '%s'.", databaseName, dataSourceName), cause);
+        super(XOpenSQLState.GENERAL_ERROR, 2, cause, String.format("Can not load table with database name '%s' and data source name '%s'.", databaseName, dataSourceName));
     }
 }