shengdoupi commented on code in PR #25122:
URL: https://github.com/apache/shardingsphere/pull/25122#discussion_r1165717814


##########
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`
   
   @RaigorJiang Thanks for your CR! `Integer.parseInt` and `Long.parseLong` are 
used without try catch in many algorithms' initial check, such as 
ShardingAutoTableAlgorithm and JobRateLimitAlgorithm, so I'm not sure if it 
necessary to use try catch here. @Pace2Car Hi, thank you very much for your 
possible advice.



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