This is an automated email from the ASF dual-hosted git repository.
menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new cc69076 Minor code style changes (#13647)
cc69076 is described below
commit cc69076b910e1ad4ddef3c452bd49f18d9ba7869
Author: Guocheng Tang <[email protected]>
AuthorDate: Tue Nov 16 20:31:55 2021 +0800
Minor code style changes (#13647)
---
.../algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java | 2 +-
.../algorithm/sharding/datetime/IntervalShardingAlgorithm.java | 4 ++--
.../sharding/route/strategy/ShardingStrategyFactory.java | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
index f2bdeed..7e743d6 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithm.java
@@ -59,7 +59,7 @@ public final class ClassBasedShardingAlgorithm implements
StandardShardingAlgori
@Override
public void init() {
String strategyKey = props.getProperty(STRATEGY_KEY);
- Preconditions.checkNotNull(strategyKey, "The props`%s` cannot be null
when uses class based sharding strategy.", STRATEGY_KEY);
+ Preconditions.checkNotNull(strategyKey, "The props `%s` cannot be null
when uses class based sharding strategy.", STRATEGY_KEY);
strategy =
ClassBasedShardingAlgorithmStrategyType.valueOf(strategyKey.toUpperCase().trim());
algorithmClassName = props.getProperty(ALGORITHM_CLASS_NAME_KEY);
Preconditions.checkNotNull(algorithmClassName, "The props `%s` cannot
be null when uses class based sharding strategy.", ALGORITHM_CLASS_NAME_KEY);
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
index 85b5bdc..88a4f9a 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/datetime/IntervalShardingAlgorithm.java
@@ -85,12 +85,12 @@ public final class IntervalShardingAlgorithm implements
StandardShardingAlgorith
}
private String getDateTimePattern() {
- Preconditions.checkArgument(props.containsKey(DATE_TIME_PATTERN_KEY),
"% can not be null.", DATE_TIME_PATTERN_KEY);
+ Preconditions.checkArgument(props.containsKey(DATE_TIME_PATTERN_KEY),
"%s can not be null.", DATE_TIME_PATTERN_KEY);
return props.getProperty(DATE_TIME_PATTERN_KEY);
}
private LocalDateTime getDateTimeLower(final String dateTimePattern) {
- Preconditions.checkArgument(props.containsKey(DATE_TIME_LOWER_KEY), "%
can not be null.", DATE_TIME_LOWER_KEY);
+ Preconditions.checkArgument(props.containsKey(DATE_TIME_LOWER_KEY),
"%s can not be null.", DATE_TIME_LOWER_KEY);
return getDateTime(DATE_TIME_LOWER_KEY,
props.getProperty(DATE_TIME_LOWER_KEY), dateTimePattern);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/strategy/ShardingStrategyFactory.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/strategy/ShardingStrategyFactory.java
index d11efcc..19592d5 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/strategy/ShardingStrategyFactory.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/strategy/ShardingStrategyFactory.java
@@ -48,8 +48,8 @@ public final class ShardingStrategyFactory {
*/
public static ShardingStrategy newInstance(final
ShardingStrategyConfiguration shardingStrategyConfig, final ShardingAlgorithm
shardingAlgorithm, final String defaultShardingColumn) {
if (shardingStrategyConfig instanceof
StandardShardingStrategyConfiguration && shardingAlgorithm instanceof
StandardShardingAlgorithm) {
- return new StandardShardingStrategy(null ==
((StandardShardingStrategyConfiguration)
shardingStrategyConfig).getShardingColumn()
- ? defaultShardingColumn :
((StandardShardingStrategyConfiguration)
shardingStrategyConfig).getShardingColumn(), (StandardShardingAlgorithm)
shardingAlgorithm);
+ String shardingColumn = ((StandardShardingStrategyConfiguration)
shardingStrategyConfig).getShardingColumn();
+ return new StandardShardingStrategy(null == shardingColumn ?
defaultShardingColumn : shardingColumn, (StandardShardingAlgorithm)
shardingAlgorithm);
}
if (shardingStrategyConfig instanceof
ComplexShardingStrategyConfiguration && shardingAlgorithm instanceof
ComplexKeysShardingAlgorithm) {
return new
ComplexShardingStrategy(((ComplexShardingStrategyConfiguration)
shardingStrategyConfig).getShardingColumns(), (ComplexKeysShardingAlgorithm)
shardingAlgorithm);