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


##########
features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFromXToYMaskAlgorithm.java:
##########
@@ -49,17 +51,29 @@ public void init(final Properties props) {
     
     private Integer createFromX(final Properties props) {
         MaskAlgorithmPropsChecker.checkIntegerTypeConfig(props, FROM_X, 
getType());
-        return Integer.parseInt(props.getProperty(FROM_X));
+        String fromXValue = props.getProperty(FROM_X);
+        if (!Strings.isNullOrEmpty(fromXValue)) {
+            fromX = Integer.parseInt(fromXValue);
+            ShardingSpherePreconditions.checkState(fromX > 0, () -> new 
MaskAlgorithmInitializationException(getType(), "from-X must be a positive 
integer."));
+        }
+        return fromX;

Review Comment:
   This code is reused and looks like it can be extracted to `Checker` class.



-- 
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