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 e0fb37fb69e Rename AlgorithmNotFoundOnTableException (#30540)
e0fb37fb69e is described below

commit e0fb37fb69e582fc30fa56765ecdc013666e3cb8
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Mar 19 12:44:45 2024 +0800

    Rename AlgorithmNotFoundOnTableException (#30540)
---
 .../java/org/apache/shardingsphere/sharding/rule/ShardingRule.java  | 4 ++--
 .../org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java   | 4 ++--
 ...otFoundException.java => AlgorithmNotFoundOnTableException.java} | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

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 b8a13cf8e47..92f3db02832 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
@@ -23,7 +23,7 @@ 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.AlgorithmNotFoundException;
+import 
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmNotFoundOnTableException;
 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;
@@ -592,7 +592,7 @@ public final class ShardingRule implements DatabaseRule {
     
     private KeyGenerateAlgorithm getKeyGenerateAlgorithm(final String 
logicTableName) {
         Optional<ShardingTable> shardingTable = 
findShardingTable(logicTableName);
-        ShardingSpherePreconditions.checkState(shardingTable.isPresent(), () 
-> new AlgorithmNotFoundException("key generator", logicTableName));
+        ShardingSpherePreconditions.checkState(shardingTable.isPresent(), () 
-> new AlgorithmNotFoundOnTableException("key generator", logicTableName));
         return null == shardingTable.get().getKeyGeneratorName() ? 
defaultKeyGenerateAlgorithm : 
keyGenerators.get(shardingTable.get().getKeyGeneratorName());
     }
     
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 d377826f69a..2fd76a01f06 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
@@ -21,7 +21,7 @@ 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.AlgorithmNotFoundException;
+import 
org.apache.shardingsphere.infra.algorithm.core.exception.AlgorithmNotFoundOnTableException;
 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;
@@ -336,7 +336,7 @@ class ShardingRuleTest {
     void assertGenerateKeyFailure() {
         AlgorithmSQLContext generateContext = mock(AlgorithmSQLContext.class);
         when(generateContext.getTableName()).thenReturn("table_0");
-        assertThrows(AlgorithmNotFoundException.class, () -> 
createMaximumShardingRule().generateKeys(generateContext, 1));
+        assertThrows(AlgorithmNotFoundOnTableException.class, () -> 
createMaximumShardingRule().generateKeys(generateContext, 1));
     }
     
     @Test
diff --git 
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundException.java
 
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundOnTableException.java
similarity index 85%
rename from 
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundException.java
rename to 
infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundOnTableException.java
index 38cc5717c63..c9a61aaa7a1 100644
--- 
a/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundException.java
+++ 
b/infra/algorithm/core/src/main/java/org/apache/shardingsphere/infra/algorithm/core/exception/AlgorithmNotFoundOnTableException.java
@@ -21,13 +21,13 @@ import 
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpe
 import 
org.apache.shardingsphere.infra.exception.core.external.sql.type.kernel.category.MetaDataSQLException;
 
 /**
- * Algorithm not found exception.
+ * Algorithm not found on table exception.
  */
-public final class AlgorithmNotFoundException extends MetaDataSQLException {
+public final class AlgorithmNotFoundOnTableException extends 
MetaDataSQLException {
     
     private static final long serialVersionUID = -6334833729231404326L;
     
-    public AlgorithmNotFoundException(final String algorithmType, final String 
tableName) {
+    public AlgorithmNotFoundOnTableException(final String algorithmType, final 
String tableName) {
         super(XOpenSQLState.CHECK_OPTION_VIOLATION, 12, "Can not find '%s' 
algorithm on table '%s'.", algorithmType, tableName);
     }
 }

Reply via email to