You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2023/06/27 09:13:39 UTC

[shardingsphere] branch master updated: Fix sonar issue in ShardingStrategyType (#26623)

This is an automated email from the ASF dual-hosted git repository.

zhaojinchao 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 6718a2679ac Fix sonar issue in ShardingStrategyType (#26623)
6718a2679ac is described below

commit 6718a2679acda57f4769b338660894ca7ef0b92f
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Tue Jun 27 17:13:32 2023 +0800

    Fix sonar issue in ShardingStrategyType (#26623)
---
 .../sharding/distsql/handler/enums/ShardingStrategyType.java            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
index f6515ad9a26..e65d60be94d 100644
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
+++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
@@ -177,7 +177,7 @@ public enum ShardingStrategyType {
      * @return sharding strategy type
      */
     public static ShardingStrategyType getValueOf(final ShardingStrategyConfiguration config) {
-        Optional<ShardingStrategyType> result = Arrays.stream(values()).filter(each -> config.getClass().getName().equals(each.getImplementedClass().getName())).findFirst();
+        Optional<ShardingStrategyType> result = Arrays.stream(values()).filter(each -> config.getClass().isAssignableFrom(each.getImplementedClass())).findFirst();
         ShardingSpherePreconditions.checkState(result.isPresent(), () -> new UnsupportedOperationException(String.format("unsupported strategy type: `%s`.", config.getClass().getName())));
         return result.get();
     }