RaigorJiang commented on code in PR #25036:
URL: https://github.com/apache/shardingsphere/pull/25036#discussion_r1161462371
##########
kernel/traffic/core/src/main/java/org/apache/shardingsphere/traffic/algorithm/traffic/segment/SQLRegexTrafficAlgorithm.java:
##########
@@ -41,8 +40,8 @@ public void init(final Properties props) {
ShardingSpherePreconditions.checkState(props.containsKey(REGEX_PROPS_KEY),
() -> new
SegmentTrafficAlgorithmInitializationException(SQLRegexTrafficAlgorithm.class.getName(),
String.format("%s cannot be null", REGEX_PROPS_KEY)));
regex = Pattern.compile(props.getProperty(REGEX_PROPS_KEY));
-
ShardingSpherePreconditions.checkState(Strings.isNullOrEmpty(String.valueOf(regex)),
- () -> new
SegmentTrafficAlgorithmInitializationException(SQLRegexTrafficAlgorithm.class.getName(),
"regex must be not null or empty"));
+
ShardingSpherePreconditions.checkState(!Strings.isNullOrEmpty(String.valueOf(regex)),
Review Comment:
Hi @Netter99 @Pace2Car
I'm wondering if the result of `props.getProperty(REGEX_PROPS_KEY)` is null,
will `Pattern.compile` throw an exception?
--
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]