You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2025/02/12 05:17:35 UTC
(shardingsphere) branch master updated: Fix sonar issues (#34634)
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 02e5e17dee2 Fix sonar issues (#34634)
02e5e17dee2 is described below
commit 02e5e17dee2b471df14e0366f4f6858e52d8cb45
Author: Haoran Meng <me...@gmail.com>
AuthorDate: Wed Feb 12 13:17:29 2025 +0800
Fix sonar issues (#34634)
---
.../executor/rdl/resource/UnregisterStorageUnitExecutorTest.java | 9 ++++-----
.../handler/distsql/ral/updatable/SetDistVariableExecutor.java | 2 +-
.../proxy/backend/util/MetaDataImportExecutor.java | 2 +-
.../handler/admin/MySQLInformationSchemaExecutorFactory.java | 2 +-
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java
index 7eceece1709..245b07d1447 100644
--- a/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java
+++ b/infra/distsql-handler/src/test/java/org/apache/shardingsphere/distsql/handler/executor/rdl/resource/UnregisterStorageUnitExecutorTest.java
@@ -21,8 +21,8 @@ import org.apache.groovy.util.Maps;
import org.apache.shardingsphere.distsql.handler.fixture.DistSQLHandlerFixtureRule;
import org.apache.shardingsphere.distsql.statement.rdl.resource.unit.type.UnregisterStorageUnitStatement;
import org.apache.shardingsphere.infra.datasource.pool.props.domain.DataSourcePoolProperties;
-import org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.MissingRequiredStorageUnitsException;
import org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.InUsedStorageUnitException;
+import org.apache.shardingsphere.infra.exception.kernel.metadata.resource.storageunit.MissingRequiredStorageUnitsException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.resource.node.StorageNode;
import org.apache.shardingsphere.infra.metadata.database.resource.unit.StorageUnit;
@@ -43,7 +43,6 @@ import org.mockito.junit.jupiter.MockitoExtension;
import org.mockito.junit.jupiter.MockitoSettings;
import org.mockito.quality.Strictness;
-import java.sql.SQLException;
import java.util.Collections;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -92,7 +91,7 @@ class UnregisterStorageUnitExecutorTest {
}
@Test
- void assertExecuteUpdateSuccess() throws SQLException {
+ void assertExecuteUpdateSuccess() {
when(database.getRuleMetaData().getInUsedStorageUnitNameAndRulesMap()).thenReturn(Collections.emptyMap());
UnregisterStorageUnitStatement sqlStatement = new UnregisterStorageUnitStatement(Collections.singleton("foo_ds"), false, false);
executor.executeUpdate(sqlStatement, contextManager);
@@ -123,7 +122,7 @@ class UnregisterStorageUnitExecutorTest {
}
@Test
- void assertExecuteUpdateWithStorageUnitInUsedWithIgnoredTables() throws SQLException {
+ void assertExecuteUpdateWithStorageUnitInUsedWithIgnoredTables() {
when(database.getRuleMetaData()).thenReturn(new RuleMetaData(Collections.singleton(new DistSQLHandlerFixtureRule())));
UnregisterStorageUnitStatement sqlStatement = new UnregisterStorageUnitStatement(Collections.singleton("foo_ds"), true, false);
executor.executeUpdate(sqlStatement, contextManager);
@@ -131,7 +130,7 @@ class UnregisterStorageUnitExecutorTest {
}
@Test
- void assertExecuteUpdateWithIfExists() throws SQLException {
+ void assertExecuteUpdateWithIfExists() {
UnregisterStorageUnitStatement sqlStatement = new UnregisterStorageUnitStatement(true, Collections.singleton("foo_ds"), true, false);
executor.executeUpdate(sqlStatement, contextManager);
verify(metaDataManagerPersistService).unregisterStorageUnits(database, sqlStatement.getStorageUnitNames());
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutor.java
index d2ef6680e9b..bb6e9de6ad9 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/SetDistVariableExecutor.java
@@ -65,7 +65,7 @@ public final class SetDistVariableExecutor implements DistSQLUpdateExecutor<SetD
}
}
- private void handleConfigurationProperty(final ContextManager contextManager, final TypedPropertyKey propertyKey, final String value) throws SQLException {
+ private void handleConfigurationProperty(final ContextManager contextManager, final TypedPropertyKey propertyKey, final String value) {
MetaDataContexts metaDataContexts = contextManager.getMetaDataContexts();
Properties props = new Properties();
props.putAll(metaDataContexts.getMetaData().getProps().getProps());
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/MetaDataImportExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/MetaDataImportExecutor.java
index b847e0b054b..6f90d231b43 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/MetaDataImportExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/MetaDataImportExecutor.java
@@ -75,7 +75,7 @@ public final class MetaDataImportExecutor {
}
}
- private void importProps(final YamlProxyServerConfiguration yamlServerConfig) throws SQLException {
+ private void importProps(final YamlProxyServerConfiguration yamlServerConfig) {
contextManager.getPersistServiceFacade().getMetaDataManagerPersistService().alterProperties(yamlServerConfig.getProps());
}
diff --git a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLInformationSchemaExecutorFactory.java b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLInformationSchemaExecutorFactory.java
index 0157d62bf18..63116373d4f 100644
--- a/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLInformationSchemaExecutorFactory.java
+++ b/proxy/backend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLInformationSchemaExecutorFactory.java
@@ -54,10 +54,10 @@ public final class MySQLInformationSchemaExecutorFactory {
return Optional.empty();
}
String tableName = ((SimpleTableSegment) sqlStatement.getFrom().get()).getTableName().getIdentifier().getValue();
- Map<String, Collection<String>> selectedSchemaTables = Collections.singletonMap("information_schema", Collections.singletonList(tableName));
if (SCHEMATA_TABLE.equalsIgnoreCase(tableName)) {
return Optional.of(new SelectInformationSchemataExecutor(sqlStatement, sql, parameters));
}
+ Map<String, Collection<String>> selectedSchemaTables = Collections.singletonMap("information_schema", Collections.singletonList(tableName));
if (isSelectSystemTable(selectedSchemaTables)) {
return Optional.of(new DefaultDatabaseMetaDataExecutor(sql, parameters));
}