You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2023/05/21 11:04:00 UTC
[shardingsphere] branch master updated: Fix sonar issue of CDCBackendHandler (#25823)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 5f88b0e2b97 Fix sonar issue of CDCBackendHandler (#25823)
5f88b0e2b97 is described below
commit 5f88b0e2b97144e6925b31edc19c8ec53a130465
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sun May 21 19:03:52 2023 +0800
Fix sonar issue of CDCBackendHandler (#25823)
---
.github/workflows/ci.yml | 2 +-
.../shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c956b1af9b6..3fc296c953c 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -51,7 +51,7 @@ concurrency:
cancel-in-progress: true
env:
- MAVEN_OPTS: -XX:+UseStringDeduplication -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dmaven.javadoc.skip=true -Djacoco.skip=true
+ MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dmaven.javadoc.skip=true -Djacoco.skip=true
REPOSITORY_NAME: shardingsphere
jobs:
diff --git a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
index 3aa6e21699b..1d0751d8adc 100644
--- a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
+++ b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
@@ -123,12 +123,10 @@ public final class CDCBackendHandler {
}
private Map<String, List<DataNode>> buildDataNodesMap(final ShardingSphereDatabase database, final Collection<String> tableNames) {
- Map<String, List<DataNode>> result = new HashMap<>();
Optional<ShardingRule> shardingRule = database.getRuleMetaData().findSingleRule(ShardingRule.class);
Optional<SingleRule> singleRule = database.getRuleMetaData().findSingleRule(SingleRule.class);
- if (!shardingRule.isPresent() && !singleRule.isPresent()) {
- throw new NoAnyRuleExistsException(database.getName());
- }
+ ShardingSpherePreconditions.checkState(shardingRule.isPresent() || singleRule.isPresent(), () -> new NoAnyRuleExistsException(database.getName()));
+ Map<String, List<DataNode>> result = new HashMap<>();
// TODO support virtual data source name
for (String each : tableNames) {
if (singleRule.isPresent() && singleRule.get().getAllDataNodes().containsKey(each)) {