Pace2Car commented on code in PR #25246:
URL: https://github.com/apache/shardingsphere/pull/25246#discussion_r1174529275


##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java:
##########
@@ -60,14 +60,19 @@ public void init(final Properties props) {
     private ClassBasedShardingAlgorithmStrategyType getStrategy(final 
Properties props) {
         String strategy = props.getProperty(STRATEGY_KEY);
         ShardingSpherePreconditions.checkNotNull(strategy,
-                () -> new ShardingAlgorithmInitializationException(getType(), 
String.format("Properties `%s` can not be null when uses class based sharding 
strategy.", STRATEGY_KEY)));
-        return 
ClassBasedShardingAlgorithmStrategyType.valueOf(strategy.toUpperCase().trim());
+                () -> new ShardingAlgorithmInitializationException(getType(), 
String.format("Properties `%s` can not be null when uses class based sharding 
strategy", STRATEGY_KEY)));
+        String shardingAlgorithmStrategyType = strategy.toUpperCase().trim();
+        ShardingSpherePreconditions.checkState(
+                
ClassBasedShardingAlgorithmStrategyType.isValidShardingAlgorithmStrategyType(shardingAlgorithmStrategyType),
+                () -> new ShardingAlgorithmInitializationException(getType(), 
String.format("Sharding strategy `%s` not support", strategy)));
+        return 
ClassBasedShardingAlgorithmStrategyType.valueOf(shardingAlgorithmStrategyType);
     }
-    
+

Review Comment:
   Please keep the same indentation with the previous line.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to