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 0697d44a98c Refactor AlgorithmDefinitionException (#30695)
0697d44a98c is described below
commit 0697d44a98cac1a822fd7de8ebec9e14e2d6b193
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Mar 30 15:53:49 2024 +0800
Refactor AlgorithmDefinitionException (#30695)
* Refactor AlgorithmDefinitionException
* Refactor AlgorithmDefinitionException
* Refactor CreateDefaultShadowAlgorithmExecutor
* Merge DuplicateAlgorithmException and AlgorithmInUsedException
---
.../user-manual/error-code/sql-error-code.cn.md | 14 +++----
.../user-manual/error-code/sql-error-code.en.md | 10 +++--
.../algorithm/standard/AESEncryptAlgorithm.java | 2 +-
.../checker/EncryptRuleConfigurationChecker.java | 4 +-
.../standard/AESEncryptAlgorithmTest.java | 2 +-
.../EncryptRuleConfigurationCheckerTest.java | 2 +-
.../handler/update/CreateEncryptRuleExecutor.java | 2 +-
.../update/CreateEncryptRuleExecutorTest.java | 2 +-
.../algorithm/MaskAlgorithmPropertiesChecker.java | 2 +-
.../algorithm/cover/KeepFromXToYMaskAlgorithm.java | 2 +-
.../algorithm/cover/MaskFromXToYMaskAlgorithm.java | 2 +-
.../GenericTableRandomReplaceAlgorithm.java | 2 +-
.../mask/checker/MaskRuleConfigurationChecker.java | 2 +-
.../MaskAlgorithmPropertiesCheckerTest.java | 2 +-
.../parameterized/MaskAlgorithmAssertions.java | 2 +-
...ReadwriteSplittingRuleConfigurationChecker.java | 2 +-
...writeSplittingRuleConfigurationCheckerTest.java | 2 +-
.../AbstractColumnMatchedShadowAlgorithm.java | 2 +-
.../column/ColumnRegexMatchedShadowAlgorithm.java | 2 +-
.../column/ColumnValueMatchedShadowAlgorithm.java | 2 +-
.../checker/ShadowRuleConfigurationChecker.java | 2 +-
.../ColumnRegexMatchShadowAlgorithmTest.java | 2 +-
.../ColumnValueMatchShadowAlgorithmTest.java | 2 +-
.../AlterDefaultShadowAlgorithmExecutor.java | 13 +++---
.../handler/update/AlterShadowRuleExecutor.java | 2 +-
.../CreateDefaultShadowAlgorithmExecutor.java | 23 ++++-------
.../update/DropDefaultShadowAlgorithmExecutor.java | 9 +++--
.../update/DropShadowAlgorithmExecutor.java | 9 +++--
.../AlterDefaultShadowAlgorithmExecutorTest.java | 8 ++--
.../update/AlterShadowRuleExecutorTest.java | 2 +-
.../DropDefaultShadowAlgorithmExecutorTest.java | 4 +-
.../classbased/ClassBasedShardingAlgorithm.java | 2 +-
.../datetime/AutoIntervalShardingAlgorithm.java | 2 +-
.../datetime/IntervalShardingAlgorithm.java | 2 +-
.../sharding/hint/HintInlineShardingAlgorithm.java | 2 +-
.../inline/ComplexInlineShardingAlgorithm.java | 2 +-
.../sharding/inline/InlineShardingAlgorithm.java | 2 +-
.../sharding/mod/HashModShardingAlgorithm.java | 2 +-
.../sharding/mod/ModShardingAlgorithm.java | 2 +-
.../range/BoundaryBasedRangeShardingAlgorithm.java | 2 +-
.../range/VolumeBasedRangeShardingAlgorithm.java | 2 +-
.../checker/ShardingRuleConfigurationChecker.java | 2 +-
.../shardingsphere/sharding/rule/ShardingRule.java | 2 +-
.../ClassBasedShardingAlgorithmTest.java | 2 +-
.../inline/ComplexInlineShardingAlgorithmTest.java | 2 +-
.../inline/InlineShardingAlgorithmTest.java | 2 +-
.../sharding/mod/HashModShardingAlgorithmTest.java | 2 +-
.../sharding/mod/ModShardingAlgorithmTest.java | 2 +-
.../sharding/rule/ShardingRuleTest.java | 2 +-
.../checker/ShardingTableRuleStatementChecker.java | 2 +-
.../AlterDefaultShardingStrategyExecutor.java | 11 ++---
.../CreateDefaultShardingStrategyExecutor.java | 9 +++--
.../update/DropShardingAlgorithmExecutor.java | 12 +++---
.../update/DropShardingAuditorExecutor.java | 10 +++--
.../update/DropShardingKeyGeneratorExecutor.java | 10 +++--
.../checker/ShardingRuleStatementCheckerTest.java | 2 +-
.../sharding/CoreAutoShardingAlgorithmFixture.java | 2 +-
.../AlterDefaultShardingStrategyExecutorTest.java | 6 +--
.../CreateDefaultShardingStrategyExecutorTest.java | 8 ++--
.../CreateShardingTableRuleExecutorTest.java | 2 +-
.../update/DropShardingAlgorithmExecutorTest.java | 6 +--
.../update/DropShardingAuditorExecutorTest.java | 8 ++--
.../DropShardingKeyGeneratorExecutorTest.java | 6 +--
.../exception}/AlgorithmDefinitionException.java | 10 ++---
.../{ => type}/AlgorithmExecuteException.java | 8 ++--
.../exception/type}/AlgorithmInUsedException.java | 6 +--
.../AlgorithmInitializationException.java | 8 ++--
.../{ => type}/EmptyAlgorithmException.java | 8 ++--
.../InvalidAlgorithmConfigurationException.java | 16 +++-----
.../{ => type}/UnregisteredAlgorithmException.java | 14 +++++--
.../snowflake/SnowflakeKeyGenerateAlgorithm.java | 4 +-
.../SnowflakeKeyGenerateAlgorithmTest.java | 4 +-
.../weight/WeightLoadBalanceAlgorithm.java | 2 +-
.../algorithm/DuplicateAlgorithmException.java | 35 ----------------
.../MissingRequiredAlgorithmException.java | 47 ----------------------
.../ratelimit/type/QPSJobRateLimitAlgorithm.java | 2 +-
.../ratelimit/type/TPSJobRateLimitAlgorithm.java | 2 +-
.../ratelimit/QPSJobRateLimitAlgorithmTest.java | 2 +-
.../ratelimit/TPSJobRateLimitAlgorithmTest.java | 2 +-
.../traffic/segment/SQLMatchTrafficAlgorithm.java | 2 +-
.../traffic/segment/SQLRegexTrafficAlgorithm.java | 2 +-
.../distsql/ral/updatable/LockClusterExecutor.java | 7 ++--
.../e2e/fixture/ITEncryptLikeAlgorithmFixture.java | 2 +-
.../RewriteEncryptLikeAlgorithmFixture.java | 2 +-
84 files changed, 186 insertions(+), 267 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index 0df8e3049f0..c52024c8a40 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -22,15 +22,17 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 42S02 | 10006 | Unknown column '%s' in '%s'.
|
| 42S02 | 10007 | Table or view \`%s\` does not exist.
|
| 42000 | 10010 | Rule does not exist.
|
-| 44000 | 10011 | Algorithm '%s.'%s' initialization failed, reason
is: %s. |
-| 44000 | 10012 | '%s' algorithm on %s is required.
|
-| 42S02 | 10013 | '%s' algorithm '%s' on %s is unregistered.
|
-| HY000 | 10015 | Algorithm '%s.%s' execute failed, reason is: %s.
|
| 42S02 | 10020 | Schema \`%s\` does not exist.
|
| 42S02 | 10021 | Single table \`%s\` does not exist.
|
| HY000 | 10022 | Can not load table with database name \`%s\` and
data source name \`%s\`. |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains
tables. |
| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`.
|
+| 44000 | 10090 | Algorithm '%s.'%s' initialization failed, reason
is: %s. |
+| 44000 | 10091 | '%s' algorithm on %s is required.
|
+| 42S02 | 10092 | '%s' algorithm '%s' on %s is unregistered.
|
+| 44000 | 10093 | Invalid %s algorithm '%s', %s.
|
+| 44000 | 10094 | %s algorithms '%s' in database '%s' are still in
used. |
+| HY000 | 10099 | Algorithm '%s.%s' execute failed, reason is: %s.
|
### 数据
@@ -164,10 +166,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| SQL State | Vendor Code | 错误信息
|
|-----------|-------------|-------------------------------------------------------------|
-| 44000 | 19150 | Invalid %s algorithm(s) \`%s\`.
|
-| 44000 | 19151 | %s algorithm(s) \`%s\` do not exist in database
\`%s\`. |
-| 44000 | 19152 | %s algorithms \`%s\` in database \`%s\` are still
in used. |
-| 44000 | 19153 | Duplicate %s algorithms \`%s\` in database \`%s\`.
|
| 44000 | 19154 | Invalid mode, error message is: \`%s\`.
|
| 44000 | 19155 | Plugin class \`%s\` not found..
|
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md
b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index 8bb7e033d54..bc2096cf890 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -31,6 +31,12 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| HY000 | 10022 | Can not load table with database name \`%s\` and
data source name \`%s\`. |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains
tables. |
| 0A000 | 10040 | Unsupported storage type of \`%s.%s\`.
|
+| 44000 | 10090 | Algorithm '%s.'%s' initialization failed, reason
is: %s. |
+| 44000 | 10091 | '%s' algorithm on %s is required.
|
+| 42S02 | 10092 | '%s' algorithm '%s' on %s is unregistered.
|
+| 44000 | 10093 | Invalid %s algorithm '%s', %s.
|
+| 44000 | 10094 | %s algorithms '%s' in database '%s' are still in
used. |
+| HY000 | 10099 | Algorithm '%s.%s' execute failed, reason is: %s.
|
### Data
@@ -164,10 +170,6 @@ SQL error codes provide by standard `SQL State`, `Vendor
Code` and `Reason`, whi
| SQL State | Vendor Code | Reason
|
|-----------|-------------|------------------------------------------------------------|
-| 44000 | 19150 | Invalid %s algorithm(s) \`%s\`.
|
-| 44000 | 19151 | %s algorithm(s) \`%s\` do not exist in database
\`%s\`. |
-| 44000 | 19152 | %s algorithms \`%s\` in database \`%s\` are still
in used. |
-| 44000 | 19153 | Duplicate %s algorithms \`%s\` in database \`%s\`.
|
| 44000 | 19154 | Invalid mode, error message is: \`%s\`.
|
| 44000 | 19155 | Plugin class \`%s\` not found..
|
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
index d9bd78ff263..7f3bfac98cf 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithm.java
@@ -26,7 +26,7 @@ import
org.apache.commons.codec.digest.MessageDigestAlgorithms;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import javax.crypto.Cipher;
diff --git
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationChecker.java
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationChecker.java
index dcb2b624cf8..0289b242560 100644
---
a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationChecker.java
+++
b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationChecker.java
@@ -28,8 +28,8 @@ import
org.apache.shardingsphere.encrypt.exception.metadata.EncryptCipherColumnN
import
org.apache.shardingsphere.encrypt.exception.metadata.EncryptLikeQueryColumnNotFoundException;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.EmptyAlgorithmException;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
index f8d8cc9bb4c..c71eac0f072 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/algorithm/standard/AESEncryptAlgorithmTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.encrypt.algorithm.standard;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
diff --git
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
index a8d2e09a9bb..c4a737e846a 100644
---
a/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
+++
b/features/encrypt/core/src/test/java/org/apache/shardingsphere/encrypt/checker/EncryptRuleConfigurationCheckerTest.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnItemRuleCo
import
org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
import
org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import org.apache.shardingsphere.infra.spi.type.ordered.OrderedSPILoader;
import org.junit.jupiter.api.Test;
diff --git
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java
index caed06aaa23..7c02b75262a 100644
---
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java
+++
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.encrypt.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException;
import
org.apache.shardingsphere.infra.exception.storageunit.EmptyStorageUnitException;
diff --git
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
index 9fbaa504963..05f97a94872 100644
---
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
+++
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/CreateEncryptRuleExecutorTest.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.encrypt.distsql.segment.EncryptColumnSegment;
import org.apache.shardingsphere.encrypt.distsql.segment.EncryptRuleSegment;
import
org.apache.shardingsphere.encrypt.distsql.statement.CreateEncryptRuleStatement;
import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
diff --git
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesChecker.java
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesChecker.java
index 75c066d6c5c..1b580940352 100644
---
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesChecker.java
+++
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesChecker.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.mask.algorithm;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
diff --git
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFromXToYMaskAlgorithm.java
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFromXToYMaskAlgorithm.java
index 3be6c72b8be..9df1904f497 100644
---
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFromXToYMaskAlgorithm.java
+++
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFromXToYMaskAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mask.algorithm.cover;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.mask.algorithm.MaskAlgorithmPropertiesChecker;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
diff --git
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskFromXToYMaskAlgorithm.java
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskFromXToYMaskAlgorithm.java
index 12fbb018cda..a93fb71a0bb 100644
---
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskFromXToYMaskAlgorithm.java
+++
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/MaskFromXToYMaskAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mask.algorithm.cover;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.mask.algorithm.MaskAlgorithmPropertiesChecker;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
diff --git
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithm.java
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithm.java
index 768c1a4a428..50bced71d0f 100644
---
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithm.java
+++
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/replace/GenericTableRandomReplaceAlgorithm.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.mask.algorithm.replace;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
diff --git
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java
index 494aa0862ec..42f0b27b11a 100644
---
a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java
+++
b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/checker/MaskRuleConfigurationChecker.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.mask.checker;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
diff --git
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesCheckerTest.java
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesCheckerTest.java
index e2906f90589..d0cb27e8999 100644
---
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesCheckerTest.java
+++
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropertiesCheckerTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.mask.algorithm;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
diff --git
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/parameterized/MaskAlgorithmAssertions.java
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/parameterized/MaskAlgorithmAssertions.java
index b09003debbe..e3a8ee99ed9 100644
---
a/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/parameterized/MaskAlgorithmAssertions.java
+++
b/features/mask/core/src/test/java/org/apache/shardingsphere/mask/algorithm/parameterized/MaskAlgorithmAssertions.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.mask.algorithm.parameterized;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.mask.spi.MaskAlgorithm;
diff --git
a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
index 866d817056a..49d67740c6d 100644
---
a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
+++
b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationChecker.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.readwritesplitting.checker;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.loadbalancer.core.LoadBalanceAlgorithm;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
diff --git
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java
index 977eb96f049..ec18de5d879 100644
---
a/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java
+++
b/features/readwrite-splitting/core/src/test/java/org/apache/shardingsphere/readwritesplitting/checker/ReadwriteSplittingRuleConfigurationCheckerTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.readwritesplitting.checker;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.attribute.RuleAttributes;
diff --git
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/AbstractColumnMatchedShadowAlgorithm.java
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/AbstractColumnMatchedShadowAlgorithm.java
index 6da79e86634..3b26664e93f 100644
---
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/AbstractColumnMatchedShadowAlgorithm.java
+++
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/AbstractColumnMatchedShadowAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
import lombok.Getter;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.shadow.algorithm.shadow.validator.ShadowValueValidator;
import org.apache.shardingsphere.shadow.api.shadow.ShadowOperationType;
diff --git
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchedShadowAlgorithm.java
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchedShadowAlgorithm.java
index d5e1c062b86..6cb1e41883a 100644
---
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchedShadowAlgorithm.java
+++
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchedShadowAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.Properties;
diff --git
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchedShadowAlgorithm.java
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchedShadowAlgorithm.java
index 318f6a869ca..a11d82a7417 100644
---
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchedShadowAlgorithm.java
+++
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchedShadowAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.Properties;
diff --git
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java
index 1dd3c4a89d8..cef85146162 100644
---
a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java
+++
b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/checker/ShadowRuleConfigurationChecker.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.shadow.checker;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
diff --git
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
index 85e952df4d2..b56c6e6ac5a 100644
---
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
+++
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithmTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.shadow.exception.data.UnsupportedShadowColumnTypeException;
import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
diff --git
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
index 8715d39f3a2..a3f8e2959a2 100644
---
a/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
+++
b/features/shadow/core/src/test/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnValueMatchShadowAlgorithmTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.algorithm.shadow.column;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.shadow.exception.data.UnsupportedShadowColumnTypeException;
import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterDefaultShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterDefaultShadowAlgorithmExecutor.java
index 294aaf605d3..1ff845ca115 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterDefaultShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterDefaultShadowAlgorithmExecutor.java
@@ -19,13 +19,14 @@ package
org.apache.shardingsphere.shadow.distsql.handler.update;
import com.google.common.base.Strings;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleAlterExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -58,12 +59,12 @@ public final class AlterDefaultShadowAlgorithmExecutor
implements DatabaseRuleAl
private void checkAlgorithms(final AlgorithmSegment algorithmSegment) {
checkAlgorithmCompleteness(algorithmSegment);
checkAlgorithmType(algorithmSegment);
-
ShadowRuleStatementChecker.checkExisted(Collections.singleton(DEFAULT_ALGORITHM_NAME),
- rule.getConfiguration().getShadowAlgorithms().keySet(),
notExistedAlgorithms -> new MissingRequiredAlgorithmException("shadow",
database.getName(), notExistedAlgorithms));
+
ShadowRuleStatementChecker.checkExisted(Collections.singleton(DEFAULT_ALGORITHM_NAME),
rule.getConfiguration().getShadowAlgorithms().keySet(),
+ notExistedAlgorithms -> new
UnregisteredAlgorithmException("Shadow", notExistedAlgorithms, new
SQLExceptionIdentifier(database.getName())));
}
private void checkAlgorithmCompleteness(final AlgorithmSegment
algorithmSegment) {
-
ShardingSpherePreconditions.checkState(!Strings.isNullOrEmpty(algorithmSegment.getName()),
() -> new InvalidAlgorithmConfigurationException("shadow"));
+
ShardingSpherePreconditions.checkState(!Strings.isNullOrEmpty(algorithmSegment.getName()),
() -> new EmptyAlgorithmException("Shadow", new SQLExceptionIdentifier("")));
}
private void checkAlgorithmType(final AlgorithmSegment algorithmSegment) {
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleExecutor.java
index c2a0be24dc1..f476f8325b5 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/AlterShadowRuleExecutor.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.shadow.distsql.handler.update;
import lombok.Setter;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleAlterExecutor;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmExecutor.java
index 4258c36a392..b8f88fa57de 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/CreateDefaultShadowAlgorithmExecutor.java
@@ -19,11 +19,12 @@ package
org.apache.shardingsphere.shadow.distsql.handler.update;
import lombok.Setter;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleCreateExecutor;
-import
org.apache.shardingsphere.infra.exception.algorithm.DuplicateAlgorithmException;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -31,11 +32,8 @@ import
org.apache.shardingsphere.shadow.distsql.statement.CreateDefaultShadowAlg
import org.apache.shardingsphere.shadow.rule.ShadowRule;
import org.apache.shardingsphere.shadow.spi.ShadowAlgorithm;
-import java.util.Collection;
import java.util.Collections;
import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
/**
* Create default shadow algorithm statement executor.
@@ -57,17 +55,13 @@ public final class CreateDefaultShadowAlgorithmExecutor
implements DatabaseRuleC
}
private void checkAlgorithmExisted() {
- Collection<String> duplicatedAlgorithmNames =
getDuplicatedAlgorithmNames();
-
ShardingSpherePreconditions.checkState(duplicatedAlgorithmNames.isEmpty(), ()
-> new DuplicateAlgorithmException("Shadow", database.getName(),
duplicatedAlgorithmNames));
- }
-
- private Collection<String> getDuplicatedAlgorithmNames() {
- Collection<String> algorithmNames = null == rule ?
Collections.emptyList() : rule.getShadowAlgorithms().keySet();
- return
Stream.of("default_shadow_algorithm").filter(algorithmNames::contains).collect(Collectors.toSet());
+ boolean isDuplicatedAlgorithmName = null != rule &&
rule.getShadowAlgorithms().containsKey("default_shadow_algorithm");
+ ShardingSpherePreconditions.checkState(!isDuplicatedAlgorithmName, ()
-> new AlgorithmInUsedException("Shadow", database.getName(),
Collections.singleton("default_shadow_algorithm")));
}
private void checkAlgorithmCompleteness(final
CreateDefaultShadowAlgorithmStatement sqlStatement) {
-
ShardingSpherePreconditions.checkState(!sqlStatement.getShadowAlgorithmSegment().getAlgorithmSegment().getName().isEmpty(),
() -> new InvalidAlgorithmConfigurationException("Shadow"));
+
ShardingSpherePreconditions.checkState(!sqlStatement.getShadowAlgorithmSegment().getAlgorithmSegment().getName().isEmpty(),
+ () -> new EmptyAlgorithmException("Shadow", new
SQLExceptionIdentifier(database.getName())));
}
private void checkAlgorithmType(final
CreateDefaultShadowAlgorithmStatement sqlStatement) {
@@ -78,8 +72,7 @@ public final class CreateDefaultShadowAlgorithmExecutor
implements DatabaseRuleC
@Override
public ShadowRuleConfiguration buildToBeCreatedRuleConfiguration(final
CreateDefaultShadowAlgorithmStatement sqlStatement) {
ShadowRuleConfiguration result = new ShadowRuleConfiguration();
- if (getDuplicatedAlgorithmNames().isEmpty()) {
- result = new ShadowRuleConfiguration();
+ if (null == rule ||
!rule.getShadowAlgorithms().containsKey("default_shadow_algorithm")) {
result.setShadowAlgorithms(buildAlgorithmMap(sqlStatement));
result.setDefaultShadowAlgorithmName("default_shadow_algorithm");
}
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmExecutor.java
index 6e7134be480..712b38e5cac 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmExecutor.java
@@ -18,10 +18,11 @@
package org.apache.shardingsphere.shadow.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleDropExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import
org.apache.shardingsphere.shadow.distsql.statement.DropDefaultShadowAlgorithmStatement;
@@ -48,8 +49,8 @@ public final class DropDefaultShadowAlgorithmExecutor
implements DatabaseRuleDro
}
private void checkAlgorithm() {
- ShardingSpherePreconditions.checkNotNull(
- rule.getConfiguration().getDefaultShadowAlgorithmName(), () ->
new MissingRequiredAlgorithmException("shadow", database.getName(),
Collections.singleton("default")));
+
ShardingSpherePreconditions.checkNotNull(rule.getConfiguration().getDefaultShadowAlgorithmName(),
+ () -> new UnregisteredAlgorithmException("Shadow", "default",
new SQLExceptionIdentifier(database.getName())));
}
@Override
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmExecutor.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmExecutor.java
index 37abdf7885c..2d379f21e40 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmExecutor.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmExecutor.java
@@ -19,10 +19,11 @@ package
org.apache.shardingsphere.shadow.distsql.handler.update;
import lombok.Setter;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleDropExecutor;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.KernelSQLException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -60,8 +61,8 @@ public final class DropShadowAlgorithmExecutor implements
DatabaseRuleDropExecut
Collection<String> requiredAlgorithms = sqlStatement.getNames();
String defaultShadowAlgorithmName =
rule.getConfiguration().getDefaultShadowAlgorithmName();
if (!sqlStatement.isIfExists()) {
- ShadowRuleStatementChecker.checkExisted(
- requiredAlgorithms, currentAlgorithms,
notExistedAlgorithms -> new MissingRequiredAlgorithmException("shadow",
database.getName(), notExistedAlgorithms));
+ ShadowRuleStatementChecker.checkExisted(requiredAlgorithms,
currentAlgorithms,
+ notExistedAlgorithms -> new
UnregisteredAlgorithmException("Shadow", notExistedAlgorithms, new
SQLExceptionIdentifier(database.getName())));
}
checkAlgorithmInUsed(requiredAlgorithms, getAlgorithmInUse(),
identical -> new AlgorithmInUsedException("Shadow", database.getName(),
identical));
ShardingSpherePreconditions.checkState(!requiredAlgorithms.contains(defaultShadowAlgorithmName),
diff --git
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java
index a3539ba4e79..864aacf5ef8 100644
---
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java
+++
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterDefaultShadowAlgorithmExecutorTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.spi.exception.ServiceProviderNotFoundException;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -66,7 +66,7 @@ class AlterDefaultShadowAlgorithmExecutorTest {
ShadowRule rule = mock(ShadowRule.class);
when(rule.getConfiguration()).thenReturn(currentConfig);
executor.setRule(rule);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
+ assertThrows(UnregisteredAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
}
@Test
@@ -80,7 +80,7 @@ class AlterDefaultShadowAlgorithmExecutorTest {
void assertExecuteIncompletenessAlgorithm() {
AlterDefaultShadowAlgorithmStatement sqlStatement = new
AlterDefaultShadowAlgorithmStatement(
new ShadowAlgorithmSegment("default_shadow_algorithm", new
AlgorithmSegment("", PropertiesBuilder.build(new Property("type", "value")))));
- assertThrows(InvalidAlgorithmConfigurationException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
+ assertThrows(EmptyAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
}
@Test
diff --git
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java
index 1da05656697..c0bbe711a89 100644
---
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java
+++
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/AlterShadowRuleExecutorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
import
org.apache.shardingsphere.infra.exception.storageunit.MissingRequiredStorageUnitsException;
diff --git
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java
index 8b2921aaa17..82e2769edc9 100644
---
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java
+++
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropDefaultShadowAlgorithmExecutorTest.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.shadow.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
import
org.apache.shardingsphere.shadow.distsql.handler.update.DropDefaultShadowAlgorithmExecutor;
@@ -57,7 +57,7 @@ class DropDefaultShadowAlgorithmExecutorTest {
ShadowRule rule = mock(ShadowRule.class);
when(rule.getConfiguration()).thenReturn(currentConfig);
executor.setRule(rule);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(new DropDefaultShadowAlgorithmStatement(false)));
+ assertThrows(UnregisteredAlgorithmException.class, () ->
executor.checkBeforeUpdate(new DropDefaultShadowAlgorithmStatement(false)));
}
@Test
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
index a7c0328f962..2f321cc659b 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.classbased;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingAlgorithm;
import
org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingValue;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
index e53909424ad..a8f39fdf595 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/AutoIntervalShardingAlgorithm.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.datetime;
import com.google.common.collect.Range;
import lombok.Getter;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.util.datetime.DateTimeFormatterFactory;
import
org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAutoTableAlgorithmUtils;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
index 03f3b7d5ba0..38d6652b0c7 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.datetime;
import com.google.common.base.Strings;
import com.google.common.collect.BoundType;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
index eee492b9007..da45bdd99dd 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/hint/HintInlineShardingAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.hint;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory;
import
org.apache.shardingsphere.sharding.api.sharding.hint.HintShardingAlgorithm;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
index fac2537c667..9f6ed9b2513 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException;
import org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
index a4aa860278e..0a9c9b072f9 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithm.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import com.google.common.base.Strings;
import groovy.lang.MissingMethodException;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.generic.UnsupportedSQLOperationException;
import org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
index c71344d9d8c..d6e8c818ea8 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.mod;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAutoTableAlgorithmUtils;
import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java
index ab18d88ca80..4b4f18f41be 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.mod;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAutoTableAlgorithmUtils;
import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java
index 53949406561..925809185d3 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/BoundaryBasedRangeShardingAlgorithm.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.range;
import com.google.common.base.Splitter;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.HashMap;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java
index 7dc35710de5..9a305642822 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/range/VolumeBasedRangeShardingAlgorithm.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.range;
import com.google.common.collect.Range;
import com.google.common.math.LongMath;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.math.RoundingMode;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/ShardingRuleConfigurationChecker.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/ShardingRuleConfigurationChecker.java
index f60581b9a09..17b5c8464b7 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/ShardingRuleConfigurationChecker.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/checker/ShardingRuleConfigurationChecker.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.checker;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.UnregisteredAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.config.rule.checker.RuleConfigurationChecker;
import org.apache.shardingsphere.infra.datanode.DataNode;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index c653dd3dfb5..37682624221 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -22,7 +22,7 @@ import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import lombok.Getter;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext;
import
org.apache.shardingsphere.infra.binder.context.statement.dml.SelectStatementContext;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmTest.java
index 3a291578419..03d6502b124 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.classbased;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingValue;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
index 954cdab28cb..f74c1138862 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/ComplexInlineShardingAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sharding.api.sharding.complex.ComplexKeysShardingValue;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithmTest.java
index 1d9619450c3..40d4d18e3e9 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/inline/InlineShardingAlgorithmTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.sharding.algorithm.sharding.inline;
import com.google.common.collect.Lists;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithmTest.java
index 1c9d473226d..8a371bbc706 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/HashModShardingAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.mod;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
index dea9216ecb9..16b39d26eea 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/sharding/mod/ModShardingAlgorithmTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.sharding.mod;
import com.google.common.collect.Range;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.datanode.DataNodeInfo;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
index dd412dac5eb..667e4b00f1c 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.sharding.rule;
import org.apache.groovy.util.Maps;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.algorithm.keygen.snowflake.SnowflakeKeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.keygen.uuid.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.binder.context.segment.table.TablesContext;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index f6622464c60..82500e8155e 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -21,7 +21,7 @@ import com.cedarsoftware.util.CaseInsensitiveSet;
import com.google.common.base.Splitter;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.exception.rule.InvalidRuleConfigurationException;
import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyExecutor.java
index a49d3a2438b..7a370c19d9f 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyExecutor.java
@@ -18,14 +18,15 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleAlterExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
+import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
@@ -61,7 +62,7 @@ public final class AlterDefaultShardingStrategyExecutor
implements DatabaseRuleA
ShardingSpherePreconditions.checkState(ShardingStrategyType.isValidType(sqlStatement.getStrategyType()),
() -> new
InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
ShardingSpherePreconditions.checkState(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType()).isValid(sqlStatement.getShardingColumn()),
() -> new
InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
-
ShardingSpherePreconditions.checkState(isAlgorithmDefinitionExists(sqlStatement),
MissingRequiredAlgorithmException::new);
+
ShardingSpherePreconditions.checkState(isAlgorithmDefinitionExists(sqlStatement),
() -> new EmptyAlgorithmException("Sharding", new SQLExceptionIdentifier("")));
}
private boolean isAlgorithmDefinitionExists(final
AlterDefaultShardingStrategyStatement sqlStatement) {
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyExecutor.java
index 0ef6d8042b8..e1339c27d26 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyExecutor.java
@@ -18,13 +18,14 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleCreateExecutor;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
+import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
@@ -61,7 +62,7 @@ public final class CreateDefaultShardingStrategyExecutor
implements DatabaseRule
ShardingSpherePreconditions.checkState(ShardingStrategyType.isValidType(sqlStatement.getStrategyType()),
() -> new
InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
ShardingSpherePreconditions.checkState(ShardingStrategyType.getValueOf(sqlStatement.getStrategyType())
.isValid(sqlStatement.getShardingColumn()), () -> new
InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
-
ShardingSpherePreconditions.checkNotNull(sqlStatement.getAlgorithmSegment(),
MissingRequiredAlgorithmException::new);
+
ShardingSpherePreconditions.checkNotNull(sqlStatement.getAlgorithmSegment(), ()
-> new EmptyAlgorithmException("Sharding", new SQLExceptionIdentifier("")));
}
private void checkExist(final CreateDefaultShardingStrategyStatement
sqlStatement) {
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmExecutor.java
index 2bd8f13f678..81c7a56e49d 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmExecutor.java
@@ -18,11 +18,12 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleDropExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
@@ -58,9 +59,8 @@ public final class DropShardingAlgorithmExecutor implements
DatabaseRuleDropExec
private void checkToBeDroppedShardingAlgorithms(final
DropShardingAlgorithmStatement sqlStatement) {
Collection<String> currentShardingAlgorithms =
getCurrentShardingAlgorithms();
Collection<String> notExistedAlgorithms =
sqlStatement.getNames().stream().filter(each ->
!currentShardingAlgorithms.contains(each)).collect(Collectors.toList());
- if (!notExistedAlgorithms.isEmpty()) {
- throw new MissingRequiredAlgorithmException(database.getName(),
notExistedAlgorithms);
- }
+ ShardingSpherePreconditions.checkState(notExistedAlgorithms.isEmpty(),
+ () -> new UnregisteredAlgorithmException("Sharding",
notExistedAlgorithms, new SQLExceptionIdentifier(database.getName())));
}
private void checkShardingAlgorithmsInUsed(final
DropShardingAlgorithmStatement sqlStatement) {
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorExecutor.java
index 70357d24610..9e6dffe0c72 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAuditorExecutor.java
@@ -18,11 +18,12 @@
package org.apache.shardingsphere.sharding.distsql.handler.update;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleDropExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.audit.ShardingAuditStrategyConfiguration;
@@ -57,7 +58,8 @@ public final class DropShardingAuditorExecutor implements
DatabaseRuleDropExecut
private void checkExist(final DropShardingAuditorStatement sqlStatement) {
Collection<String> notExistAuditors =
sqlStatement.getNames().stream().filter(each ->
!rule.getConfiguration().getAuditors().containsKey(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistAuditors.isEmpty(), ()
-> new MissingRequiredAlgorithmException("Sharding auditor",
database.getName(), notExistAuditors));
+ ShardingSpherePreconditions.checkState(notExistAuditors.isEmpty(),
+ () -> new UnregisteredAlgorithmException("Sharding auditor",
notExistAuditors, new SQLExceptionIdentifier(database.getName())));
}
private void checkInUsed(final DropShardingAuditorStatement sqlStatement) {
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorExecutor.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorExecutor.java
index 1dd8a93da58..8a3808f8188 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorExecutor.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorExecutor.java
@@ -19,11 +19,12 @@ package
org.apache.shardingsphere.sharding.distsql.handler.update;
import com.google.common.base.Strings;
import lombok.Setter;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.rdl.rule.spi.database.DatabaseRuleDropExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorCurrentRuleRequired;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
@@ -58,7 +59,8 @@ public final class DropShardingKeyGeneratorExecutor
implements DatabaseRuleDropE
private void checkExist(final DropShardingKeyGeneratorStatement
sqlStatement) {
Collection<String> notExistKeyGenerators =
sqlStatement.getNames().stream().filter(each ->
!rule.getConfiguration().getKeyGenerators().containsKey(each)).collect(Collectors.toList());
-
ShardingSpherePreconditions.checkState(notExistKeyGenerators.isEmpty(), () ->
new MissingRequiredAlgorithmException("Key generator", database.getName(),
notExistKeyGenerators));
+ ShardingSpherePreconditions.checkState(notExistKeyGenerators.isEmpty(),
+ () -> new UnregisteredAlgorithmException("Key generator",
notExistKeyGenerators, new SQLExceptionIdentifier(database.getName())));
}
private void checkInUsed(final DropShardingKeyGeneratorStatement
sqlStatement) {
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
index 3e9aa131f70..a3ad135ead7 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/checker/ShardingRuleStatementCheckerTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.distsql.checker;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import
org.apache.shardingsphere.sharding.exception.strategy.InvalidShardingStrategyConfigurationException;
import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.exception.rule.MissingRequiredRuleException;
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreAutoShardingAlgorithmFixture.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreAutoShardingAlgorithmFixture.java
index a82f99864a1..c9454026ce7 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreAutoShardingAlgorithmFixture.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/sharding/CoreAutoShardingAlgorithmFixture.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.distsql.fixture.sharding;
import com.google.common.base.Preconditions;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.sharding.algorithm.sharding.ShardingAutoTableAlgorithmUtils;
import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java
index 12557ce15ed..cc6a3e1dc95 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterDefaultShardingStrategyExecutorTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
@@ -70,7 +70,7 @@ class AlterDefaultShardingStrategyExecutorTest {
when(rule.getConfiguration()).thenReturn(currentRuleConfig);
executor.setRule(rule);
AlterDefaultShardingStrategyStatement sqlStatement = new
AlterDefaultShardingStrategyStatement("TABLE", "standard", "order_id", null);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
+ assertThrows(EmptyAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
}
@Test
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java
index a0e66207b4e..5155454cc03 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateDefaultShardingStrategyExecutorTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
+import org.apache.shardingsphere.infra.exception.rule.DuplicateRuleException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
@@ -65,7 +65,7 @@ class CreateDefaultShardingStrategyExecutorTest {
@Test
void assertExecuteWithoutAlgorithm() {
CreateDefaultShardingStrategyStatement statement = new
CreateDefaultShardingStrategyStatement(false, "TABLE", "standard", "order_id",
null);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(statement));
+ assertThrows(EmptyAlgorithmException.class, () ->
executor.checkBeforeUpdate(statement));
}
@Test
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java
index 85c89e35657..3546de94994 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingTableRuleExecutorTest.java
@@ -21,7 +21,7 @@ import lombok.SneakyThrows;
import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
import org.apache.shardingsphere.distsql.statement.DistSQLStatement;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
-import
org.apache.shardingsphere.infra.exception.algorithm.InvalidAlgorithmConfigurationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.InvalidAlgorithmConfigurationException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.metadata.database.resource.ResourceMetaData;
import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java
index 84e88ef6338..60e7f6fc933 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAlgorithmExecutorTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.RuleDefinitionException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -59,7 +59,7 @@ class DropShardingAlgorithmExecutorTest {
ShardingRule rule = mock(ShardingRule.class);
when(rule.getConfiguration()).thenReturn(new
ShardingRuleConfiguration());
executor.setRule(rule);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(createSQLStatement("t_order")));
+ assertThrows(UnregisteredAlgorithmException.class, () ->
executor.checkBeforeUpdate(createSQLStatement("t_order")));
}
@Test
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java
index 3923ac49207..7606e70e6d9 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingAuditorExecutorTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
@@ -34,8 +34,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Properties;
-import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -56,7 +56,7 @@ class DropShardingAuditorExecutorTest {
ShardingRule rule = mock(ShardingRule.class);
when(rule.getConfiguration()).thenReturn(new
ShardingRuleConfiguration());
executor.setRule(rule);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(createSQLStatement("sharding_key_required_auditor")));
+ assertThrows(UnregisteredAlgorithmException.class, () ->
executor.checkBeforeUpdate(createSQLStatement("sharding_key_required_auditor")));
}
@Test
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java
index d7b571be1a3..2f2043d97d3 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingKeyGeneratorExecutorTest.java
@@ -17,9 +17,9 @@
package org.apache.shardingsphere.sharding.distsql.update;
-import
org.apache.shardingsphere.infra.exception.algorithm.AlgorithmInUsedException;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
import
org.apache.shardingsphere.infra.algorithm.core.config.AlgorithmConfiguration;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInUsedException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.UnregisteredAlgorithmException;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
@@ -54,7 +54,7 @@ class DropShardingKeyGeneratorExecutorTest {
ShardingRule rule = mock(ShardingRule.class);
when(rule.getConfiguration()).thenReturn(new
ShardingRuleConfiguration());
executor.setRule(rule);
- assertThrows(MissingRequiredAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
+ assertThrows(UnregisteredAlgorithmException.class, () ->
executor.checkBeforeUpdate(sqlStatement));
}
@Test
diff --git
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/AlgorithmDefinitionException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmDefinitionException.java
similarity index 79%
rename from
infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/AlgorithmDefinitionException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmDefinitionException.java
index 6ca961f3c8c..53a0161b86f 100644
---
a/infra/exception/core/src/main/java/org/apache/shardingsphere/infra/exception/core/external/sql/type/kernel/category/AlgorithmDefinitionException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmDefinitionException.java
@@ -15,21 +15,19 @@
* limitations under the License.
*/
-package
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category;
+package org.apache.shardingsphere.infra.algorithm.core.exception;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.KernelSQLException;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
/**
* Algorithm definition exception.
*/
-public abstract class AlgorithmDefinitionException extends KernelSQLException {
+public abstract class AlgorithmDefinitionException extends
MetaDataSQLException {
private static final long serialVersionUID = -8947223495845000542L;
- private static final int KERNEL_CODE = 9;
-
protected AlgorithmDefinitionException(final SQLState sqlState, final int
errorCode, final String reason, final Object... messageArgs) {
- super(sqlState, KERNEL_CODE, errorCode, reason, messageArgs);
+ super(sqlState, errorCode, reason, messageArgs);
}
}
diff --git
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmExecuteException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmExecuteException.java
similarity index 85%
rename from
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmExecuteException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmExecuteException.java
index 9af51b570d1..027821a2a25 100644
---
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmExecuteException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmExecuteException.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.algorithm.core.exception;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
import org.apache.shardingsphere.infra.algorithm.core.ShardingSphereAlgorithm;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
/**
* Algorithm execute exception.
*/
-public final class AlgorithmExecuteException extends MetaDataSQLException {
+public final class AlgorithmExecuteException extends
AlgorithmDefinitionException {
private static final long serialVersionUID = -9099514178650043282L;
public AlgorithmExecuteException(final ShardingSphereAlgorithm algorithm,
final String reason, final Object... args) {
- super(XOpenSQLState.GENERAL_ERROR, 15, "Algorithm '%s.%s' execute
failed, reason is: %s.",
+ super(XOpenSQLState.GENERAL_ERROR, 99, "Algorithm '%s.%s' execute
failed, reason is: %s.",
algorithm.getClass().getSuperclass().getSimpleName(),
algorithm.getType(), String.format(reason, args));
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/AlgorithmInUsedException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInUsedException.java
similarity index 79%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/AlgorithmInUsedException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInUsedException.java
index 284237b080a..b605f7a7ac2 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/AlgorithmInUsedException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInUsedException.java
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.exception.algorithm;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.AlgorithmDefinitionException;
import java.util.Collection;
@@ -30,6 +30,6 @@ public final class AlgorithmInUsedException extends
AlgorithmDefinitionException
private static final long serialVersionUID = -8735125626190637177L;
public AlgorithmInUsedException(final String type, final String
databaseName, final Collection<String> algorithmNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 152, "%s algorithms `%s`
in database `%s` are still in used.", type, algorithmNames, databaseName);
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 94, "%s algorithms '%s' in
database '%s' are still in used.", type, algorithmNames, databaseName);
}
}
diff --git
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmInitializationException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInitializationException.java
similarity index 85%
rename from
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmInitializationException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInitializationException.java
index bf1b4115b88..efa8114a073 100644
---
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmInitializationException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/AlgorithmInitializationException.java
@@ -15,21 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.algorithm.core.exception;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
import org.apache.shardingsphere.infra.algorithm.core.ShardingSphereAlgorithm;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
/**
* Algorithm initialization exception.
*/
-public final class AlgorithmInitializationException extends
MetaDataSQLException {
+public final class AlgorithmInitializationException extends
AlgorithmDefinitionException {
private static final long serialVersionUID = -7634670846091616790L;
public AlgorithmInitializationException(final ShardingSphereAlgorithm
algorithm, final String reason, final Object... args) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 11, "Algorithm '%s.'%s'
initialization failed, reason is: %s.",
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 90, "Algorithm '%s.'%s'
initialization failed, reason is: %s.",
algorithm.getClass().getSuperclass().getSimpleName(),
algorithm.getType(), String.format(reason, args));
}
}
diff --git
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/EmptyAlgorithmException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/EmptyAlgorithmException.java
similarity index 84%
rename from
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/EmptyAlgorithmException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/EmptyAlgorithmException.java
index f49cb06ecc5..46c15b2fa7b 100644
---
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/EmptyAlgorithmException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/EmptyAlgorithmException.java
@@ -15,20 +15,20 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.algorithm.core.exception;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
/**
* Empty algorithm exception.
*/
-public final class EmptyAlgorithmException extends MetaDataSQLException {
+public final class EmptyAlgorithmException extends
AlgorithmDefinitionException {
private static final long serialVersionUID = 8128067899672436211L;
public EmptyAlgorithmException(final String algorithmType, final
SQLExceptionIdentifier sqlExceptionIdentifier) {
- super(XOpenSQLState.NOT_FOUND, 12, "'%s' algorithm on %s is
required.", algorithmType, sqlExceptionIdentifier);
+ super(XOpenSQLState.NOT_FOUND, 91, "'%s' algorithm on %s is
required.", algorithmType, sqlExceptionIdentifier);
}
}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/InvalidAlgorithmConfigurationException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/InvalidAlgorithmConfigurationException.java
similarity index 63%
rename from
infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/InvalidAlgorithmConfigurationException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/InvalidAlgorithmConfigurationException.java
index 871c2745091..ae7b934534b 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/InvalidAlgorithmConfigurationException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/InvalidAlgorithmConfigurationException.java
@@ -15,12 +15,10 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.exception.algorithm;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.AlgorithmDefinitionException;
-
-import java.util.Collection;
/**
* Invalid algorithm configuration exception.
@@ -29,19 +27,15 @@ public final class InvalidAlgorithmConfigurationException
extends AlgorithmDefin
private static final long serialVersionUID = 1352014079406440573L;
- public InvalidAlgorithmConfigurationException(final String algorithmType,
final Collection<String> algorithms) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 150,
String.format("Invalid %s algorithms `%s`.", algorithmType, algorithms));
- }
-
public InvalidAlgorithmConfigurationException(final String algorithmType,
final String algorithm, final String message) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 150,
String.format("Invalid %s algorithm `%s`, %s.", algorithmType, algorithm,
message));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 93, "Invalid %s algorithm
'%s', %s.", algorithmType, algorithm, message);
}
public InvalidAlgorithmConfigurationException(final String algorithmType,
final String algorithm) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 150,
String.format("Invalid %s algorithm `%s`.", algorithmType, algorithm));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 93, "Invalid %s algorithm
`%s`.", algorithmType, algorithm);
}
public InvalidAlgorithmConfigurationException(final String algorithmType) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 150,
String.format("Invalid %s algorithm.", algorithmType));
+ super(XOpenSQLState.CHECK_OPTION_VIOLATION, 93, "Invalid %s
algorithm.", algorithmType);
}
}
diff --git
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/UnregisteredAlgorithmException.java
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/UnregisteredAlgorithmException.java
similarity index 69%
rename from
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/UnregisteredAlgorithmException.java
rename to
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/UnregisteredAlgorithmException.java
index 5a08a6093fe..037a34c0048 100644
---
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/UnregisteredAlgorithmException.java
+++
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/type/UnregisteredAlgorithmException.java
@@ -15,20 +15,26 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.infra.algorithm.core.exception;
+package org.apache.shardingsphere.infra.algorithm.core.exception.type;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmDefinitionException;
import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
+
+import java.util.Collection;
/**
* Unregistered algorithm exception.
*/
-public final class UnregisteredAlgorithmException extends MetaDataSQLException
{
+public final class UnregisteredAlgorithmException extends
AlgorithmDefinitionException {
private static final long serialVersionUID = -4570489906443880879L;
public UnregisteredAlgorithmException(final String algorithmType, final
String algorithmName, final SQLExceptionIdentifier sqlExceptionIdentifier) {
- super(XOpenSQLState.NOT_FOUND, 13, "'%s' algorithm '%s' on %s is
unregistered.", algorithmType, algorithmName, sqlExceptionIdentifier);
+ super(XOpenSQLState.NOT_FOUND, 92, "'%s' algorithm '%s' on %s is
unregistered.", algorithmType, algorithmName, sqlExceptionIdentifier);
+ }
+
+ public UnregisteredAlgorithmException(final String algorithmType, final
Collection<String> algorithmNames, final SQLExceptionIdentifier
sqlExceptionIdentifier) {
+ super(XOpenSQLState.NOT_FOUND, 92, "'%s' algorithm '%s' on %s are
unregistered.", algorithmType, String.join(", ", algorithmNames),
sqlExceptionIdentifier);
}
}
diff --git
a/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithm.java
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithm.java
index 0ad003101c5..ceedac15fab 100644
---
a/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithm.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithm.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.infra.algorithm.keygen.snowflake;
import lombok.Setter;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmExecuteException;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmExecuteException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.instance.InstanceContext;
diff --git
a/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithmTest.java
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithmTest.java
index b0bbd7e7b9b..bf99f7de7db 100644
---
a/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithmTest.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/infra/algorithm/keygen/snowflake/SnowflakeKeyGenerateAlgorithmTest.java
@@ -19,8 +19,8 @@ package
org.apache.shardingsphere.infra.algorithm.keygen.snowflake;
import lombok.SneakyThrows;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmExecuteException;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmExecuteException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.algorithm.keygen.core.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.keygen.snowflake.fixture.FixedTimeService;
import
org.apache.shardingsphere.infra.algorithm.keygen.snowflake.fixture.WorkerIdGeneratorFixture;
diff --git
a/infra/algorithm/load-balancer/type/weight/src/main/java/org/apache/shardingsphere/infra/algorithm/loadbalancer/weight/WeightLoadBalanceAlgorithm.java
b/infra/algorithm/load-balancer/type/weight/src/main/java/org/apache/shardingsphere/infra/algorithm/loadbalancer/weight/WeightLoadBalanceAlgorithm.java
index d6ef3923750..887be7491eb 100644
---
a/infra/algorithm/load-balancer/type/weight/src/main/java/org/apache/shardingsphere/infra/algorithm/loadbalancer/weight/WeightLoadBalanceAlgorithm.java
+++
b/infra/algorithm/load-balancer/type/weight/src/main/java/org/apache/shardingsphere/infra/algorithm/loadbalancer/weight/WeightLoadBalanceAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.infra.algorithm.loadbalancer.weight;
import com.google.common.base.Preconditions;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.algorithm.loadbalancer.core.LoadBalanceAlgorithm;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/DuplicateAlgorithmException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/DuplicateAlgorithmException.java
deleted file mode 100644
index 2e3b85e7f5e..00000000000
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/DuplicateAlgorithmException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.exception.algorithm;
-
-import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.AlgorithmDefinitionException;
-
-import java.util.Collection;
-
-/**
- * Duplicate algorithm exception.
- */
-public final class DuplicateAlgorithmException extends
AlgorithmDefinitionException {
-
- private static final long serialVersionUID = 3503761639898230997L;
-
- public DuplicateAlgorithmException(final String type, final String
databaseName, final Collection<String> auditorNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 153, "Duplicate %s
algorithms `%s` in database `%s`.", type, auditorNames, databaseName);
- }
-}
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/MissingRequiredAlgorithmException.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/MissingRequiredAlgorithmException.java
deleted file mode 100644
index bec1eb2effe..00000000000
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/exception/algorithm/MissingRequiredAlgorithmException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.infra.exception.algorithm;
-
-import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.AlgorithmDefinitionException;
-
-import java.util.Collection;
-
-/**
- * Missing required algorithm exception.
- */
-public final class MissingRequiredAlgorithmException extends
AlgorithmDefinitionException {
-
- private static final long serialVersionUID = 4591071898233749618L;
-
- public MissingRequiredAlgorithmException() {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 151, "Algorithm does not
exist.");
- }
-
- public MissingRequiredAlgorithmException(final String type, final String
databaseName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 151, String.format("%s
algorithm does not exist in database `%s`.", type, databaseName));
- }
-
- public MissingRequiredAlgorithmException(final String type, final
Collection<String> algorithmNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 151, String.format("%s
algorithms `%s` do not exist.", type, algorithmNames));
- }
-
- public MissingRequiredAlgorithmException(final String type, final String
databaseName, final Collection<String> algorithmNames) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 151, String.format("%s
algorithms `%s` do not exist in database `%s`.", type, algorithmNames,
databaseName));
- }
-}
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithm.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithm.java
index 3b595947f1a..d575d163187 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithm.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/QPSJobRateLimitAlgorithm.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
import com.google.common.util.concurrent.RateLimiter;
import
org.apache.shardingsphere.data.pipeline.core.constant.PipelineSQLOperationType;
import
org.apache.shardingsphere.data.pipeline.core.ratelimit.JobRateLimitAlgorithm;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.Properties;
diff --git
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithm.java
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithm.java
index 7dfc48b85dd..56b4fe72534 100644
---
a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithm.java
+++
b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/type/TPSJobRateLimitAlgorithm.java
@@ -21,7 +21,7 @@ import com.google.common.base.Strings;
import com.google.common.util.concurrent.RateLimiter;
import
org.apache.shardingsphere.data.pipeline.core.constant.PipelineSQLOperationType;
import
org.apache.shardingsphere.data.pipeline.core.ratelimit.JobRateLimitAlgorithm;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import java.util.Properties;
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/QPSJobRateLimitAlgorithmTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/QPSJobRateLimitAlgorithmTest.java
index 781bbddb07c..d9297e75869 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/QPSJobRateLimitAlgorithmTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/QPSJobRateLimitAlgorithmTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.data.pipeline.core.ratelimit;
import
org.apache.shardingsphere.data.pipeline.core.constant.PipelineSQLOperationType;
import
org.apache.shardingsphere.data.pipeline.core.ratelimit.type.QPSJobRateLimitAlgorithm;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.junit.jupiter.api.BeforeEach;
diff --git
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/TPSJobRateLimitAlgorithmTest.java
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/TPSJobRateLimitAlgorithmTest.java
index beb64714db6..ed95279f0ea 100644
---
a/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/TPSJobRateLimitAlgorithmTest.java
+++
b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/ratelimit/TPSJobRateLimitAlgorithmTest.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.data.pipeline.core.ratelimit;
import
org.apache.shardingsphere.data.pipeline.core.constant.PipelineSQLOperationType;
import
org.apache.shardingsphere.data.pipeline.core.ratelimit.type.TPSJobRateLimitAlgorithm;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.junit.jupiter.api.BeforeEach;
diff --git
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLMatchTrafficAlgorithm.java
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLMatchTrafficAlgorithm.java
index 8c12a171915..5e7d8d96121 100644
---
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLMatchTrafficAlgorithm.java
+++
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLMatchTrafficAlgorithm.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.traffic.algorithm.traffic.segment;
import com.google.common.base.CharMatcher;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.sql.parser.sql.common.util.SQLUtils;
import
org.apache.shardingsphere.traffic.api.traffic.segment.SegmentTrafficAlgorithm;
diff --git
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLRegexTrafficAlgorithm.java
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLRegexTrafficAlgorithm.java
index f2a4327263f..35edb24c94f 100644
---
a/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLRegexTrafficAlgorithm.java
+++
b/kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLRegexTrafficAlgorithm.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.traffic.algorithm.traffic.segment;
import com.google.common.base.Strings;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import
org.apache.shardingsphere.traffic.api.traffic.segment.SegmentTrafficAlgorithm;
import
org.apache.shardingsphere.traffic.api.traffic.segment.SegmentTrafficValue;
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutor.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutor.java
index c1ef1eab15a..e168414a1fe 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutor.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/LockClusterExecutor.java
@@ -17,11 +17,12 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable;
-import
org.apache.shardingsphere.infra.exception.algorithm.MissingRequiredAlgorithmException;
-import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorClusterModeRequired;
import
org.apache.shardingsphere.distsql.handler.engine.update.DistSQLUpdateExecutor;
+import
org.apache.shardingsphere.distsql.handler.required.DistSQLExecutorClusterModeRequired;
import
org.apache.shardingsphere.distsql.statement.ral.updatable.LockClusterStatement;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.EmptyAlgorithmException;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.identifier.SQLExceptionIdentifier;
import org.apache.shardingsphere.infra.lock.GlobalLockNames;
import org.apache.shardingsphere.infra.lock.LockContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
@@ -58,7 +59,7 @@ public final class LockClusterExecutor implements
DistSQLUpdateExecutor<LockClus
}
private void checkAlgorithm(final LockClusterStatement sqlStatement) {
-
ShardingSpherePreconditions.checkNotNull(sqlStatement.getLockStrategy(),
MissingRequiredAlgorithmException::new);
+
ShardingSpherePreconditions.checkNotNull(sqlStatement.getLockStrategy(), () ->
new EmptyAlgorithmException("Lock", new SQLExceptionIdentifier("")));
TypedSPILoader.checkService(ClusterLockStrategy.class,
sqlStatement.getLockStrategy().getName(),
sqlStatement.getLockStrategy().getProps());
}
diff --git
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
index 51ab4fa60b5..7662a90d156 100644
---
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
+++
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITEncryptLikeAlgorithmFixture.java
@@ -23,7 +23,7 @@ import lombok.SneakyThrows;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import java.io.IOException;
import java.io.InputStream;
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
index 12f9dd31a48..36cdfd18ccd 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/encrypt/RewriteEncryptLikeAlgorithmFixture.java
@@ -23,7 +23,7 @@ import lombok.SneakyThrows;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithm;
import org.apache.shardingsphere.encrypt.spi.EncryptAlgorithmMetaData;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
-import
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmInitializationException;
+import
org.apache.shardingsphere.infra.algorithm.core.exception.type.AlgorithmInitializationException;
import java.io.IOException;
import java.io.InputStream;