Pace2Car commented on code in PR #25122:
URL: https://github.com/apache/shardingsphere/pull/25122#discussion_r1163623704
##########
features/sharding/plugin/cosid/src/main/java/org/apache/shardingsphere/sharding/cosid/algorithm/keygen/CosIdSnowflakeKeyGenerateAlgorithm.java:
##########
@@ -73,7 +73,10 @@ private boolean getAsString(final Properties props) {
}
private long getEpoch(final Properties props) {
- return Long.parseLong(props.getProperty(EPOCH_KEY, DEFAULT_EPOCH +
""));
+ long result = Long.parseLong(props.getProperty(EPOCH_KEY,
DEFAULT_EPOCH + ""));
+ ShardingSpherePreconditions.checkState(result > 0L,
+ () -> new ShardingPluginException("Key generate algorithm `%s`
initialization failed, reason is: %s.", getType(), "Epoch must be positive."));
Review Comment:
@shengdoupi Sorry, I forgot to check the dependencies, so it's fine to keep
it as it is.
--
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]