Pace2Car commented on code in PR #25041:
URL: https://github.com/apache/shardingsphere/pull/25041#discussion_r1169710736
##########
features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/cover/KeepFirstNLastMMaskAlgorithm.java:
##########
@@ -48,18 +50,32 @@ public void init(final Properties props) {
}
private Integer createFirstN(final Properties props) {
+ int firstN = 0;
MaskAlgorithmPropsChecker.checkIntegerTypeConfig(props, FIRST_N,
getType());
- return Integer.parseInt(props.getProperty(FIRST_N));
+ String firstNValue = props.getProperty(FIRST_N);
+ if (!Strings.isNullOrEmpty(firstNValue)) {
+ firstN = Integer.parseInt(firstNValue);
+ ShardingSpherePreconditions.checkState(firstN > 0, () -> new
MaskAlgorithmInitializationException(getType(), "first-n must be a positive
integer."));
+ }
Review Comment:
Here can be extract the method to MaskAlgorithmPropsChecker, and it can be
reused
--
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]