RaigorJiang commented on code in PR #25122:
URL: https://github.com/apache/shardingsphere/pull/25122#discussion_r1164930071
##########
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java:
##########
@@ -113,7 +113,9 @@ private int getMaxVibrationOffset(final Properties props) {
}
private int getMaxTolerateTimeDifferenceMilliseconds(final Properties
props) {
- return
Integer.parseInt(props.getOrDefault(MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS_KEY,
MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS).toString());
+ int result =
Integer.parseInt(props.getOrDefault(MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS_KEY,
MAX_TOLERATE_TIME_DIFFERENCE_MILLISECONDS).toString());
Review Comment:
Hi @shengdoupi
`Integer.parseInt` may throw `NumberFormatException` (when value is not a
number), so try catch is needed here and wrapped as
`KeyGenerateAlgorithmInitializationException`
--
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]