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/03/28 13:52:04 UTC
[shardingsphere] branch master updated: Upgrade maven-checkstyle-plugin to 3.2.1 (#24877)
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 d7d3863fe5b Upgrade maven-checkstyle-plugin to 3.2.1 (#24877)
d7d3863fe5b is described below
commit d7d3863fe5bed02c3a8e2247f738d859793d43d1
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Tue Mar 28 21:51:45 2023 +0800
Upgrade maven-checkstyle-plugin to 3.2.1 (#24877)
---
.../fixture/targeted/TargetObjectFixture.java | 2 ++
.../agent/plugin/core/util/AgentReflectionUtils.java | 4 ++--
.../agent/plugin/tracing/advice/AdviceTestBase.java | 3 +++
.../mysql/constant/MySQLNewParametersBoundFlag.java | 1 +
.../db/protocol/mysql/constant/MySQLStatusFlag.java | 1 +
.../binary/execute/MySQLComStmtExecutePacket.java | 2 +-
.../query/text/MySQLTextResultSetRowPacket.java | 2 +-
.../mysql/packet/handshake/MySQLHandshakePacket.java | 1 +
.../postgresql/constant/PostgreSQLValueFormat.java | 1 +
.../packet/command/PostgreSQLCommandPacketType.java | 1 +
.../command/query/extended/PostgreSQLColumnType.java | 1 +
.../protocol/PostgreSQLArrayParameterDecoder.java | 18 +++++++++---------
.../protocol/PostgreSQLBinaryTimestampUtils.java | 3 +++
.../bind/protocol/PostgreSQLTextTimeUtils.java | 1 +
.../extended/close/PostgreSQLComClosePacket.java | 1 +
.../identifier/PostgreSQLMessagePacketType.java | 1 +
.../DataSourcePropertiesValidateHandler.java | 1 +
.../rewrite/condition/EncryptConditionEngine.java | 2 +-
.../EncryptInsertValueParameterRewriter.java | 2 +-
.../generator/EncryptAssignmentTokenGenerator.java | 4 ++--
.../shardingsphere/encrypt/rule/EncryptTable.java | 2 ++
.../mask/algorithm/MaskAlgorithmPropsChecker.java | 3 +++
.../route/ReadwriteSplittingDataSourceRouter.java | 2 +-
.../shadow/validator/ShadowValueValidator.java | 1 +
.../ClassBasedShardingAlgorithmFactory.java | 1 +
.../groupby/aggregation/AggregationUnitFactory.java | 1 +
.../validator/ddl/ShardingDDLStatementValidator.java | 3 +++
.../validator/dml/ShardingDMLStatementValidator.java | 5 ++---
.../sharding/rule/BindingTableRule.java | 2 ++
.../shardingsphere/sharding/rule/ShardingRule.java | 1 +
.../distsql/handler/enums/ShardingStrategyType.java | 1 +
.../ShowShardingTableRulesUsedAlgorithmExecutor.java | 8 ++++----
.../select/projection/engine/ProjectionEngine.java | 2 +-
.../database/metadata/url/StandardJdbcUrlParser.java | 1 +
.../infra/state/cluster/ClusterStateContext.java | 1 +
.../impl/driver/jdbc/type/util/ResultSetUtils.java | 6 +++---
.../infra/rewrite/context/SQLRewriteContext.java | 2 +-
.../infra/util/spi/type/typed/TypedSPILoader.java | 1 +
.../core/driver/ShardingSphereDriverURLManager.java | 7 ++++---
.../PipelineDataSourceConfigurationFactory.java | 1 +
.../cdc/client/util/ProtobufAnyValueConverter.java | 1 +
.../data/pipeline/cdc/util/CDCSchemaTableUtils.java | 5 ++---
.../pipeline/cdc/util/ColumnValueConvertUtils.java | 1 +
.../data/pipeline/api/datanode/DataNodeUtils.java | 1 +
.../ingest/position/PrimaryKeyPositionFactory.java | 1 +
.../data/pipeline/core/execute/ExecuteEngine.java | 1 +
.../pipeline/core/importer/DataRecordMerger.java | 2 +-
.../core/ingest/channel/memory/ManualBitSet.java | 1 +
.../data/pipeline/core/util/DatabaseTypeUtils.java | 2 +-
.../ingest/OpenGaussPositionInitializer.java | 1 +
.../postgresql/ingest/wal/WALEventConverter.java | 3 ++-
.../api/impl/ConsistencyCheckJobAPI.java | 1 +
.../optimizer/converter/SQLNodeConverterEngine.java | 1 +
.../orderby/item/OrderByItemConverterUtils.java | 1 +
.../translatable/ParseRexNodeVisitorImpl.java | 6 +++---
.../transaction/ConnectionTransaction.java | 2 +-
.../transaction/xa/fixture/DataSourceUtils.java | 1 +
.../cluster/nacos/entity/ServiceMetaData.java | 5 ++---
.../zookeeper/handler/ZookeeperExceptionHandler.java | 1 +
pom.xml | 2 +-
.../proxy/backend/connector/ProxySQLExecutor.java | 20 +++++++++++++-------
.../callback/ProxyJDBCExecutorCallbackFactory.java | 1 +
.../proxy/backend/context/ProxyContext.java | 5 ++---
.../proxy/backend/handler/cdc/CDCBackendHandler.java | 13 ++++---------
.../handler/data/DatabaseBackendHandlerFactory.java | 2 +-
.../distsql/DistSQLBackendHandlerFactory.java | 1 +
.../distsql/ral/common/enums/VariableEnum.java | 1 +
.../session/transaction/TransactionStatus.java | 5 ++---
.../proxy/backend/util/ExportUtils.java | 1 +
.../hbase/context/HBaseRegionWarmUpContext.java | 1 +
.../converter/HBaseOperationConverterFactory.java | 1 +
.../proxy/backend/hbase/executor/HBaseExecutor.java | 3 +++
.../backend/hbase/util/HBaseHeterogeneousUtils.java | 5 ++---
.../proxy/arguments/BootstrapArguments.java | 1 +
.../postgresql/command/query/extended/Portal.java | 1 +
.../core/database/parser/SQLParserExecutor.java | 1 +
.../parser/core/database/visitor/SQLVisitorRule.java | 1 +
src/resources/checkstyle.xml | 13 +++++++------
src/resources/checkstyle_ci.xml | 13 +++++++------
.../e2e/agent/common/env/EnvironmentProperties.java | 1 +
.../atomic/adapter/AdapterContainerFactory.java | 1 +
.../governance/GovernanceContainerFactory.java | 1 +
.../atomic/storage/StorageContainerFactory.java | 1 +
.../impl/StorageContainerConfigurationFactory.java | 1 +
.../test/e2e/env/runtime/DataSourceEnvironment.java | 3 +++
.../cases/DatabaseClusterEnvironmentFactory.java | 3 ++-
.../discovery/env/DiscoveryE2ETestEnvironment.java | 3 ++-
.../pipeline/cases/PipelineContainerComposer.java | 1 +
.../data/pipeline/env/PipelineE2EEnvironment.java | 13 ++++++++-----
.../framework/helper/PipelineCaseHelper.java | 3 ++-
.../data/pipeline/util/DataSourceExecuteUtils.java | 3 +++
.../cases/autocommit/MySQLAutoCommitTestCase.java | 2 +-
.../autocommit/PostgreSQLAutoCommitTestCase.java | 2 +-
.../commitrollback/MultiJDBCConnectionsTestCase.java | 2 +-
.../cases/cursor/OpenGaussCursorTestCase.java | 2 +-
.../cases/readonly/MySQLSetReadOnlyTestCase.java | 2 +-
.../readonly/PostgreSQLSetReadOnlyTestCase.java | 2 +-
.../cases/savepoint/MySQLSavePointTestCase.java | 2 +-
.../cases/savepoint/OpenGaussSavePointTestCase.java | 2 +-
.../cases/savepoint/PostgreSQLSavePointTestCase.java | 2 +-
.../cases/truncate/MySQLLocalTruncateTestCase.java | 2 +-
.../cases/truncate/MySQLXATruncateTestCase.java | 2 +-
.../transaction/env/TransactionE2EEnvironment.java | 9 +++++----
.../config/StorageContainerConfigurationFactory.java | 1 +
.../container/jdbc/ShardingSphereJDBCContainer.java | 1 +
.../internal/asserts/segment/table/TableAssert.java | 4 ++--
.../cases/sql/type/CaseTypedSQLBuilderFactory.java | 1 +
.../test/it/rewrite/engine/SQLRewriterIT.java | 2 +-
108 files changed, 194 insertions(+), 111 deletions(-)
diff --git a/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java b/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java
index 9d3182f1499..e707a5e2f1a 100644
--- a/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java
+++ b/agent/core/src/test/java/org/apache/shardingsphere/fixture/targeted/TargetObjectFixture.java
@@ -38,6 +38,7 @@ public final class TargetObjectFixture {
* Call instance method when exception thrown.
*
* @param queue queue
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public void callWhenExceptionThrown(final List<String> queue) {
throw new UnsupportedOperationException();
@@ -56,6 +57,7 @@ public final class TargetObjectFixture {
* Call static method when exception thrown.
*
* @param queue queue
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static void staticCallWhenExceptionThrown(final List<String> queue) {
throw new UnsupportedOperationException();
diff --git a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
index 7fc344f91e3..27e78a72bd3 100644
--- a/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
+++ b/agent/plugins/core/src/main/java/org/apache/shardingsphere/agent/plugin/core/util/AgentReflectionUtils.java
@@ -38,14 +38,14 @@ public final class AgentReflectionUtils {
* @param fieldName field name
* @param <T> type of field value
* @return field value
+ * @throws IllegalStateException illegal state exception
*/
- @SneakyThrows(ReflectiveOperationException.class)
public static <T> T getFieldValue(final Object target, final String fieldName) {
Optional<Field> field = findField(fieldName, target.getClass());
if (field.isPresent()) {
return getFieldValue(target, field.get());
}
- throw new NoSuchFieldException(String.format("Can not find field name `%s` in class %s.", fieldName, target.getClass()));
+ throw new IllegalStateException(String.format("Can not find field name `%s` in class %s.", fieldName, target.getClass()));
}
@SuppressWarnings("unchecked")
diff --git a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java b/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
index bb2de27819a..db31bdf2452 100644
--- a/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
+++ b/agent/plugins/tracing/test/src/main/java/org/apache/shardingsphere/agent/plugin/tracing/advice/AdviceTestBase.java
@@ -17,6 +17,9 @@
package org.apache.shardingsphere.agent.plugin.tracing.advice;
+/**
+ * Advice test base.
+ */
public interface AdviceTestBase {
/**
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlag.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
index 84ae65ba0f4..8818fa19200 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
@@ -41,6 +41,7 @@ public enum MySQLNewParametersBoundFlag {
*
* @param value value
* @return new parameters bound flag
+ * @throws MySQLProtocolException MySQL protocol exception
*/
public static MySQLNewParametersBoundFlag valueOf(final int value) {
for (MySQLNewParametersBoundFlag each : values()) {
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
index 796f86f910a..58843f9d43f 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
@@ -67,6 +67,7 @@ public enum MySQLStatusFlag {
*
* @param value value
* @return MySQL status flag
+ * @throws UnknownSQLException unknown SQL exception
*/
public static MySQLStatusFlag valueOf(final int value) {
for (MySQLStatusFlag each : values()) {
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacket.java
index 0dd5f088b1e..08196296359 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacket.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/binary/execute/MySQLComStmtExecutePacket.java
@@ -41,7 +41,7 @@ import java.util.Set;
*
* @see <a href="https://dev.mysql.com/doc/internals/en/com-stmt-execute.html">COM_STMT_EXECUTE</a>
*/
-@ToString(of = {"statementId"})
+@ToString(of = "statementId")
public final class MySQLComStmtExecutePacket extends MySQLCommandPacket {
private static final int ITERATION_COUNT = 1;
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
index f48b27de1ca..77583bcaff3 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacket.java
@@ -59,7 +59,7 @@ public final class MySQLTextResultSetRowPacket implements MySQLPacket {
} else {
if (each instanceof byte[]) {
payload.writeBytesLenenc((byte[]) each);
- } else if ((each instanceof Timestamp) && (0 == ((Timestamp) each).getNanos())) {
+ } else if (each instanceof Timestamp && 0 == ((Timestamp) each).getNanos()) {
payload.writeStringLenenc(each.toString().split("\\.")[0]);
} else if (each instanceof BigDecimal) {
payload.writeStringLenenc(((BigDecimal) each).toPlainString());
diff --git a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
index 88f87394e5a..ae178afa084 100644
--- a/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
+++ b/db-protocol/mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/packet/handshake/MySQLHandshakePacket.java
@@ -86,6 +86,7 @@ public final class MySQLHandshakePacket implements MySQLPacket {
* From test, the 13th byte is nul byte and should be excluded from authPluginDataPart2.
*
* @param payload MySQL packet payload
+ * @return auth plugin data part2
*/
private byte[] readAuthPluginDataPart2(final MySQLPacketPayload payload) {
return isClientSecureConnection() ? payload.readStringNulByBytes() : new byte[0];
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java
index 96226ca74e9..69faf6bd7e7 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/constant/PostgreSQLValueFormat.java
@@ -39,6 +39,7 @@ public enum PostgreSQLValueFormat {
*
* @param code format code
* @return PostgreSQL value format
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static PostgreSQLValueFormat valueOf(final int code) {
switch (code) {
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
index d354fa3d32d..04ba4e85af9 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
@@ -67,6 +67,7 @@ public enum PostgreSQLCommandPacketType implements CommandPacketType, PostgreSQL
*
* @param value integer value
* @return command packet type enum
+ * @throws PostgreSQLProtocolException PostgreSQL protocol exception
*/
public static PostgreSQLCommandPacketType valueOf(final int value) {
for (PostgreSQLCommandPacketType each : values()) {
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
index 1787782a575..681ef062a2c 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/PostgreSQLColumnType.java
@@ -196,6 +196,7 @@ public enum PostgreSQLColumnType implements BinaryColumnType {
*
* @param value value
* @return PostgreSQL column type
+ * @throws PostgreSQLProtocolException PostgreSQL protocol exception
*/
public static PostgreSQLColumnType valueOf(final int value) {
for (PostgreSQLColumnType each : values()) {
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java
index 7e43f83041b..c5bf8b0aac8 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLArrayParameterDecoder.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.infra.util.exception.ShardingSpherePrecondition
import org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnsupportedSQLOperationException;
import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.stream.Collectors;
@@ -176,16 +175,17 @@ public final class PostgreSQLArrayParameterDecoder {
if ("NULL".equals(each)) {
return null;
}
- if ('"' == each.charAt(0) && '"' == each.charAt(each.length() - 1)) {
- each = each.substring(1, each.length() - 1);
+ String result = each;
+ if ('"' == result.charAt(0) && '"' == result.charAt(result.length() - 1)) {
+ result = result.substring(1, result.length() - 1);
}
- while (each.contains("\\\"")) {
- each = each.replace("\\\"", "\"");
+ while (result.contains("\\\"")) {
+ result = result.replace("\\\"", "\"");
}
- while (each.contains("\\\\")) {
- each = each.replace("\\\\", "\\");
+ while (result.contains("\\\\")) {
+ result = result.replace("\\\\", "\\");
}
- return each;
- }).collect(Collectors.toCollection(ArrayList::new));
+ return result;
+ }).collect(Collectors.toList());
}
}
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtils.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtils.java
index 414f016d631..5330039f756 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtils.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLBinaryTimestampUtils.java
@@ -55,6 +55,9 @@ public final class PostgreSQLBinaryTimestampUtils {
/**
* Refer to <a href="https://github.com/pgjdbc/pgjdbc/blob/e5e36bd3e8ac87ae554ac5cd1ac664fcd0010073/pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java#L1453-L1475">
* org.postgresql.jdbc.TimestampUtils</a>.
+ *
+ * @param seconds seconds
+ * @return epoch of PostgreSQL
*/
private static long convertJavaEpochToPgEpoch(final long seconds) {
long offsetSeconds = seconds - POSTGRESQL_SECONDS_OFFSET;
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtils.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtils.java
index 3e78f248a97..f696b5f4dc2 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtils.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLTextTimeUtils.java
@@ -40,6 +40,7 @@ public final class PostgreSQLTextTimeUtils {
*
* @param value text value to be parsed
* @return time
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static LocalTime parse(final String value) {
try {
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
index 05b3b5cbbc4..cc6862e5003 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
@@ -67,6 +67,7 @@ public final class PostgreSQLComClosePacket extends PostgreSQLCommandPacket {
*
* @param type type
* @return type
+ * @throws PostgreSQLProtocolException PostgreSQL protocol exception
*/
public static Type valueOf(final char type) {
for (Type each : values()) {
diff --git a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
index a3d19d8c8e2..b81eccfb3af 100644
--- a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
+++ b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
@@ -97,6 +97,7 @@ public enum PostgreSQLMessagePacketType implements PostgreSQLIdentifierTag {
*
* @param value integer value
* @return command packet type enum
+ * @throws PostgreSQLProtocolException PostgreSQL protocol exception
*/
public static PostgreSQLMessagePacketType valueOf(final int value) {
for (PostgreSQLMessagePacketType each : values()) {
diff --git a/distsql/handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePropertiesValidateHandler.java b/distsql/handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePropertiesValidateHandler.java
index 1e6101c2783..7841a3f0f47 100644
--- a/distsql/handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePropertiesValidateHandler.java
+++ b/distsql/handler/src/main/java/org/apache/shardingsphere/distsql/handler/validate/DataSourcePropertiesValidateHandler.java
@@ -33,6 +33,7 @@ public final class DataSourcePropertiesValidateHandler {
* Validate data source properties map.
*
* @param dataSourcePropertiesMap data source properties map
+ * @throws InvalidStorageUnitsException invalid storage units exception
*/
public void validate(final Map<String, DataSourceProperties> dataSourcePropertiesMap) {
Collection<String> errorMessages = new DataSourcePropertiesValidator().validate(dataSourcePropertiesMap);
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
index ac55fbd6957..413590a6c71 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/condition/EncryptConditionEngine.java
@@ -167,7 +167,7 @@ public final class EncryptConditionEngine {
}
private Optional<EncryptCondition> createCompareEncryptCondition(final String tableName, final BinaryOperationExpression expression, final ExpressionSegment compareRightValue) {
- if (!(expression.getLeft() instanceof ColumnSegment) || (compareRightValue instanceof SubqueryExpressionSegment)) {
+ if (!(expression.getLeft() instanceof ColumnSegment) || compareRightValue instanceof SubqueryExpressionSegment) {
return Optional.empty();
}
if (compareRightValue instanceof SimpleExpressionSegment) {
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
index 7430324ec97..605dc1e9ee0 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/rewriter/EncryptInsertValueParameterRewriter.java
@@ -59,7 +59,7 @@ public final class EncryptInsertValueParameterRewriter implements ParameterRewri
@Override
public boolean isNeedRewrite(final SQLStatementContext<?> sqlStatementContext) {
return sqlStatementContext instanceof InsertStatementContext && !InsertStatementHandler.getSetAssignmentSegment(((InsertStatementContext) sqlStatementContext).getSqlStatement()).isPresent()
- && (null == ((InsertStatementContext) sqlStatementContext).getInsertSelectContext());
+ && null == ((InsertStatementContext) sqlStatementContext).getInsertSelectContext();
}
@Override
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAssignmentTokenGenerator.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAssignmentTokenGenerator.java
index b970e351ec1..29a9299b76c 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAssignmentTokenGenerator.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rewrite/token/generator/EncryptAssignmentTokenGenerator.java
@@ -57,8 +57,8 @@ public final class EncryptAssignmentTokenGenerator implements CollectionSQLToken
@Override
public boolean isGenerateSQLToken(final SQLStatementContext<?> sqlStatementContext) {
- return sqlStatementContext instanceof UpdateStatementContext || (sqlStatementContext instanceof InsertStatementContext
- && InsertStatementHandler.getSetAssignmentSegment(((InsertStatementContext) sqlStatementContext).getSqlStatement()).isPresent());
+ return sqlStatementContext instanceof UpdateStatementContext || sqlStatementContext instanceof InsertStatementContext
+ && InsertStatementHandler.getSetAssignmentSegment(((InsertStatementContext) sqlStatementContext).getSqlStatement()).isPresent();
}
@Override
diff --git a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
index b9249b046a3..c7354e8e535 100644
--- a/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
+++ b/features/encrypt/core/src/main/java/org/apache/shardingsphere/encrypt/rule/EncryptTable.java
@@ -96,6 +96,7 @@ public final class EncryptTable {
*
* @param cipherColumn cipher column
* @return logic column
+ * @throws EncryptLogicColumnNotFoundException encrypt logic column not found exception
*/
public String getLogicColumnByCipherColumn(final String cipherColumn) {
for (Entry<String, EncryptColumn> entry : columns.entrySet()) {
@@ -111,6 +112,7 @@ public final class EncryptTable {
*
* @param plainColumn plain column
* @return logic column
+ * @throws EncryptLogicColumnNotFoundException encrypt logic column not found exception
*/
public String getLogicColumnByPlainColumn(final String plainColumn) {
for (Entry<String, EncryptColumn> entry : columns.entrySet()) {
diff --git a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropsChecker.java b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropsChecker.java
index 97ec9c0b75a..52310d707ec 100644
--- a/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropsChecker.java
+++ b/features/mask/core/src/main/java/org/apache/shardingsphere/mask/algorithm/MaskAlgorithmPropsChecker.java
@@ -35,6 +35,7 @@ public final class MaskAlgorithmPropsChecker {
* @param props props
* @param singleCharConfigKey single char config key
* @param maskType mask type
+ * @throws MaskAlgorithmInitializationException mask algorithm initialization exception
*/
public static void checkSingleCharConfig(final Properties props, final String singleCharConfigKey, final String maskType) {
if (!props.containsKey(singleCharConfigKey)) {
@@ -51,6 +52,7 @@ public final class MaskAlgorithmPropsChecker {
* @param props props
* @param atLeastOneCharConfigKey at least one char config key
* @param maskType mask type
+ * @throws MaskAlgorithmInitializationException mask algorithm initialization exception
*/
public static void checkAtLeastOneCharConfig(final Properties props, final String atLeastOneCharConfigKey, final String maskType) {
if (!props.containsKey(atLeastOneCharConfigKey)) {
@@ -67,6 +69,7 @@ public final class MaskAlgorithmPropsChecker {
* @param props props
* @param integerTypeConfigKey integer type config key
* @param maskType mask type
+ * @throws MaskAlgorithmInitializationException mask algorithm initialization exception
*/
public static void checkIntegerTypeConfig(final Properties props, final String integerTypeConfigKey, final String maskType) {
if (!props.containsKey(integerTypeConfigKey)) {
diff --git a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingDataSourceRouter.java b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingDataSourceRouter.java
index 936337c2ae2..2bd4f481076 100644
--- a/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingDataSourceRouter.java
+++ b/features/readwrite-splitting/core/src/main/java/org/apache/shardingsphere/readwritesplitting/route/ReadwriteSplittingDataSourceRouter.java
@@ -76,7 +76,7 @@ public final class ReadwriteSplittingDataSourceRouter {
}
private boolean isHintWriteRouteOnly(final SQLStatementContext<?> sqlStatementContext) {
- return HintManager.isWriteRouteOnly() || (sqlStatementContext instanceof CommonSQLStatementContext && ((CommonSQLStatementContext<?>) sqlStatementContext).isHintWriteRouteOnly());
+ return HintManager.isWriteRouteOnly() || sqlStatementContext instanceof CommonSQLStatementContext && ((CommonSQLStatementContext<?>) sqlStatementContext).isHintWriteRouteOnly();
}
private String routeInTransaction() {
diff --git a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
index 2a2c081c3b3..3e0b66cbb7b 100644
--- a/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
+++ b/features/shadow/core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
@@ -44,6 +44,7 @@ public final class ShadowValueValidator {
* @param table table name
* @param column column name
* @param shadowValue shadow value
+ * @throws UnsupportedShadowColumnTypeException unsupported shadow column type exception
*/
public static void validate(final String table, final String column, final Comparable<?> shadowValue) {
for (Class<?> each : UNSUPPORTED_TYPES) {
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmFactory.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmFactory.java
index b3a30628218..9b4f5a7f2f8 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmFactory.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/sharding/classbased/ClassBasedShardingAlgorithmFactory.java
@@ -39,6 +39,7 @@ public final class ClassBasedShardingAlgorithmFactory {
* @param props properties
* @param <T> class generic type
* @return sharding algorithm instance
+ * @throws ShardingAlgorithmClassImplementationException sharding algorithm class implementation exception
*/
@SuppressWarnings("unchecked")
@SneakyThrows(ReflectiveOperationException.class)
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/AggregationUnitFactory.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/AggregationUnitFactory.java
index 41ee0b144cf..ec87fa3ad55 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/AggregationUnitFactory.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/merge/dql/groupby/aggregation/AggregationUnitFactory.java
@@ -34,6 +34,7 @@ public final class AggregationUnitFactory {
* @param type aggregation function type
* @param isDistinct is distinct
* @return aggregation unit instance
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static AggregationUnit create(final AggregationType type, final boolean isDistinct) {
switch (type) {
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
index 6a652c9394a..597a9c5524c 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/ShardingDDLStatementValidator.java
@@ -41,6 +41,7 @@ public abstract class ShardingDDLStatementValidator<T extends DDLStatement> impl
* @param shardingRule sharding rule
* @param operation operation
* @param tables tables
+ * @throws UnsupportedShardingOperationException unsupported sharding operation exception
*/
protected void validateShardingTable(final ShardingRule shardingRule, final String operation, final Collection<SimpleTableSegment> tables) {
for (SimpleTableSegment each : tables) {
@@ -56,6 +57,7 @@ public abstract class ShardingDDLStatementValidator<T extends DDLStatement> impl
*
* @param schema ShardingSphere schema
* @param tables tables
+ * @throws NoSuchTableException no such table exception
*/
protected void validateTableExist(final ShardingSphereSchema schema, final Collection<SimpleTableSegment> tables) {
for (SimpleTableSegment each : tables) {
@@ -71,6 +73,7 @@ public abstract class ShardingDDLStatementValidator<T extends DDLStatement> impl
*
* @param schema ShardingSphere schema
* @param tables tables
+ * @throws TableExistsException table exists exception
*/
protected void validateTableNotExist(final ShardingSphereSchema schema, final Collection<SimpleTableSegment> tables) {
for (SimpleTableSegment each : tables) {
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
index 157850a1469..ac34b00d789 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/dml/ShardingDMLStatementValidator.java
@@ -21,6 +21,7 @@ import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
import org.apache.shardingsphere.infra.route.context.RouteContext;
import org.apache.shardingsphere.infra.route.context.RouteMapper;
import org.apache.shardingsphere.infra.route.context.RouteUnit;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.sharding.exception.syntax.DMLWithMultipleShardingTablesException;
import org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
import org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditions;
@@ -57,9 +58,7 @@ public abstract class ShardingDMLStatementValidator<T extends SQLStatement> impl
boolean isAllShardingTables = shardingRule.isAllShardingTables(tableNames) && (1 == tableNames.size() || shardingRule.isAllBindingTables(tableNames));
boolean isAllBroadcastTables = shardingRule.isAllBroadcastTables(tableNames);
boolean isAllSingleTables = !shardingRule.tableRuleExists(tableNames);
- if (!(isAllShardingTables || isAllBroadcastTables || isAllSingleTables)) {
- throw new DMLWithMultipleShardingTablesException(tableNames);
- }
+ ShardingSpherePreconditions.checkState(isAllShardingTables || isAllBroadcastTables || isAllSingleTables, () -> new DMLWithMultipleShardingTablesException(tableNames));
}
/**
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/BindingTableRule.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/BindingTableRule.java
index 1c9928e87bb..5cd80321e70 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/BindingTableRule.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/BindingTableRule.java
@@ -56,6 +56,8 @@ public final class BindingTableRule {
* @param otherLogicTable other logic table name in same binding table rule
* @param otherActualTable other actual table name in same binding table rule
* @return actual table name
+ * @throws ActualTableNotFoundException actual table not found exception
+ * @throws BindingTableNotFoundException binding table not found exception
*/
public String getBindingActualTable(final String dataSource, final String logicTable, final String otherLogicTable, final String otherActualTable) {
Optional<TableRule> otherLogicTableRule = Optional.ofNullable(tableRules.get(otherLogicTable.toLowerCase()));
diff --git a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index 790b42be597..de0efa1b67f 100644
--- a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -354,6 +354,7 @@ public final class ShardingRule implements DatabaseRule, DataNodeContainedRule,
*
* @param logicTableName logic table name
* @return table rule
+ * @throws ShardingTableRuleNotFoundException sharding table rule not found exception
*/
public TableRule getTableRule(final String logicTableName) {
Optional<TableRule> tableRule = findTableRule(logicTableName);
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
index 907b9ce311d..6b9399a033a 100644
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
+++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
@@ -159,6 +159,7 @@ public enum ShardingStrategyType {
*
* @param name name
* @return sharding strategy type
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static ShardingStrategyType getValueOf(final String name) {
try {
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
index 8fe95f8bb03..8b47f2ee42b 100644
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
+++ b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShowShardingTableRulesUsedAlgorithmExecutor.java
@@ -53,10 +53,10 @@ public final class ShowShardingTableRulesUsedAlgorithmExecutor implements RQLExe
boolean matchDefaultTableShardingStrategy = null != config.getDefaultTableShardingStrategy()
&& algorithmName.equals(config.getDefaultTableShardingStrategy().getShardingAlgorithmName());
config.getTables().forEach(each -> {
- if (((null == each.getDatabaseShardingStrategy() && matchDefaultDatabaseShardingStrategy)
- || (null != each.getDatabaseShardingStrategy() && algorithmName.equals(each.getDatabaseShardingStrategy().getShardingAlgorithmName())))
- || ((null == each.getTableShardingStrategy() && matchDefaultTableShardingStrategy)
- || (null != each.getTableShardingStrategy() && algorithmName.equals(each.getTableShardingStrategy().getShardingAlgorithmName())))) {
+ if (null == each.getDatabaseShardingStrategy() && matchDefaultDatabaseShardingStrategy
+ || null != each.getDatabaseShardingStrategy() && algorithmName.equals(each.getDatabaseShardingStrategy().getShardingAlgorithmName())
+ || null == each.getTableShardingStrategy() && matchDefaultTableShardingStrategy
+ || null != each.getTableShardingStrategy() && algorithmName.equals(each.getTableShardingStrategy().getShardingAlgorithmName())) {
result.add(new LocalDataQueryResultRow("table", each.getLogicTable()));
}
});
diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
index 1dc187099bf..42a3486691f 100644
--- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
+++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/segment/select/projection/engine/ProjectionEngine.java
@@ -211,7 +211,7 @@ public final class ProjectionEngine {
Collection<Projection> remainingProjections = new LinkedList<>();
for (Projection each : getOriginalProjections(joinTable, projectionSegment)) {
Collection<Projection> actualProjections = getActualProjections(Collections.singletonList(each));
- if ((joinTable.getUsing().isEmpty() && !joinTable.isNatural()) || (null != owner && each.getExpression().contains(owner))) {
+ if (joinTable.getUsing().isEmpty() && !joinTable.isNatural() || null != owner && each.getExpression().contains(owner)) {
result.addAll(actualProjections);
} else {
remainingProjections.addAll(actualProjections);
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParser.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParser.java
index 2b1a13014b8..c7456f671bb 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParser.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/database/metadata/url/StandardJdbcUrlParser.java
@@ -52,6 +52,7 @@ public final class StandardJdbcUrlParser {
*
* @param jdbcUrl JDBC URL to be parsed
* @return parsed JDBC URL
+ * @throws UnrecognizedDatabaseURLException unrecognized database URL exception
*/
public JdbcUrl parse(final String jdbcUrl) {
Matcher matcher = CONNECTION_URL_PATTERN.matcher(jdbcUrl);
diff --git a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/cluster/ClusterStateContext.java b/infra/common/src/main/java/org/apache/shardingsphere/infra/state/cluster/ClusterStateContext.java
index 10d9ce6d025..f5699729264 100644
--- a/infra/common/src/main/java/org/apache/shardingsphere/infra/state/cluster/ClusterStateContext.java
+++ b/infra/common/src/main/java/org/apache/shardingsphere/infra/state/cluster/ClusterStateContext.java
@@ -31,6 +31,7 @@ public final class ClusterStateContext {
* Switch state.
*
* @param state state
+ * @throws IllegalStateException illegal state exception
*/
public void switchState(final ClusterState state) {
if (currentState == state) {
diff --git a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
index 9148e3318d9..b752cf52c3c 100644
--- a/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
+++ b/infra/executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtils.java
@@ -29,7 +29,6 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.MalformedURLException;
import java.net.URL;
-import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.sql.Time;
import java.sql.Timestamp;
@@ -52,9 +51,9 @@ public final class ResultSetUtils {
* @param value original value
* @param convertType expected class type
* @return converted value
- * @throws SQLException SQL exception
+ * @throws SQLFeatureNotSupportedException SQL feature not supported exception
*/
- public static Object convertValue(final Object value, final Class<?> convertType) throws SQLException {
+ public static Object convertValue(final Object value, final Class<?> convertType) throws SQLFeatureNotSupportedException {
ShardingSpherePreconditions.checkState(null != convertType, () -> new SQLFeatureNotSupportedException("Type can not be null"));
if (null == value) {
return convertNullValue(convertType);
@@ -108,6 +107,7 @@ public final class ResultSetUtils {
* @param needScale need scale
* @param scale scale size
* @return big decimal
+ * @throws UnsupportedDataTypeConversionException unsupported data type conversion exception
*/
public static Object convertBigDecimalValue(final Object value, final boolean needScale, final int scale) {
if (null == value) {
diff --git a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContext.java b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContext.java
index 3d11f620a51..1770a72b34b 100644
--- a/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContext.java
+++ b/infra/rewrite/src/main/java/org/apache/shardingsphere/infra/rewrite/context/SQLRewriteContext.java
@@ -73,7 +73,7 @@ public final class SQLRewriteContext {
if (!((CommonSQLStatementContext<?>) sqlStatementContext).isHintSkipSQLRewrite()) {
addSQLTokenGenerators(new DefaultTokenGeneratorBuilder(sqlStatementContext).getSQLTokenGenerators());
}
- parameterBuilder = ((sqlStatementContext instanceof InsertStatementContext) && (null == ((InsertStatementContext) sqlStatementContext).getInsertSelectContext()))
+ parameterBuilder = (sqlStatementContext instanceof InsertStatementContext && null == ((InsertStatementContext) sqlStatementContext).getInsertSelectContext())
? new GroupedParameterBuilder(
((InsertStatementContext) sqlStatementContext).getGroupedParameters(), ((InsertStatementContext) sqlStatementContext).getOnDuplicateKeyUpdateParameters())
: new StandardParameterBuilder(params);
diff --git a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
index 0540392956c..1f00bfa91fc 100644
--- a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
+++ b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/spi/type/typed/TypedSPILoader.java
@@ -135,6 +135,7 @@ public final class TypedSPILoader {
* @param props properties
* @param <T> SPI class type
* @return check result
+ * @throws ServiceProviderNotFoundServerException service provider not found server exception
*/
public static <T extends TypedSPI> boolean checkService(final Class<T> spiClass, final String type, final Properties props) {
Collection<T> serviceInstances = ShardingSphereServiceLoader.getServiceInstances(spiClass);
diff --git a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManager.java b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManager.java
index a8c50c35d03..ba2e7b62023 100644
--- a/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManager.java
+++ b/jdbc/core/src/main/java/org/apache/shardingsphere/driver/jdbc/core/driver/ShardingSphereDriverURLManager.java
@@ -26,10 +26,11 @@ import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
public final class ShardingSphereDriverURLManager {
/**
- * Get config content from url.
+ * Get config content from URL.
*
- * @param url the driver url
- * @return the config content
+ * @param url driver URL
+ * @return configuration content
+ * @throws DriverURLProviderNotFoundException driver URL provider not found exception
*/
public static byte[] getContent(final String url) {
for (ShardingSphereDriverURLProvider each : ShardingSphereServiceLoader.getServiceInstances(ShardingSphereDriverURLProvider.class)) {
diff --git a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/PipelineDataSourceConfigurationFactory.java b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/PipelineDataSourceConfigurationFactory.java
index eb98bb58114..6be3cd61e79 100644
--- a/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/PipelineDataSourceConfigurationFactory.java
+++ b/kernel/data-pipeline/api/src/main/java/org/apache/shardingsphere/data/pipeline/api/datasource/config/PipelineDataSourceConfigurationFactory.java
@@ -35,6 +35,7 @@ public final class PipelineDataSourceConfigurationFactory {
* @param type type of pipeline data source configuration
* @param param parameter of pipeline data source configuration
* @return created instance
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static PipelineDataSourceConfiguration newInstance(final String type, final String param) {
switch (type) {
diff --git a/kernel/data-pipeline/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java b/kernel/data-pipeline/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java
index cd5048d4427..54dc757daaa 100644
--- a/kernel/data-pipeline/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java
+++ b/kernel/data-pipeline/cdc/client/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/client/util/ProtobufAnyValueConverter.java
@@ -47,6 +47,7 @@ public final class ProtobufAnyValueConverter {
* @param any any
* @return object
* @throws InvalidProtocolBufferException invalid protocol buffer exception
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static Object convertToObject(final Any any) throws InvalidProtocolBufferException {
if (null == any || any.is(Empty.class)) {
diff --git a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java
index 9e4a532f411..48fa59d47ab 100644
--- a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java
+++ b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCSchemaTableUtils.java
@@ -23,6 +23,7 @@ import org.apache.shardingsphere.infra.database.type.SchemaSupportedDatabaseType
import org.apache.shardingsphere.infra.exception.SchemaNotFoundException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import java.util.Collection;
import java.util.HashMap;
@@ -70,9 +71,7 @@ public final class CDCSchemaTableUtils {
} else if ("*".equals(each.getTable())) {
String schemaName = each.getSchema().isEmpty() ? getDefaultSchema(database.getProtocolType()) : each.getSchema();
ShardingSphereSchema schema = database.getSchema(schemaName);
- if (null == schema) {
- throw new SchemaNotFoundException(each.getSchema());
- }
+ ShardingSpherePreconditions.checkNotNull(schema, () -> new SchemaNotFoundException(each.getSchema()));
schema.getAllTableNames().forEach(tableName -> result.computeIfAbsent(schemaName, ignored -> new HashSet<>()).add(tableName));
} else {
result.computeIfAbsent(each.getSchema(), ignored -> new HashSet<>()).add(each.getTable());
diff --git a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/ColumnValueConvertUtils.java b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/ColumnValueConvertUtils.java
index 10f8850e607..1b78c69aa5b 100644
--- a/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/ColumnValueConvertUtils.java
+++ b/kernel/data-pipeline/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/ColumnValueConvertUtils.java
@@ -61,6 +61,7 @@ public final class ColumnValueConvertUtils {
*
* @param object object
* @return protobuf message
+ * @throws RuntimeException runtime exception
*/
@SuppressWarnings("deprecation")
public static Message convertToProtobufMessage(final Object object) {
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/datanode/DataNodeUtils.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/datanode/DataNodeUtils.java
index 4fd2ee5b954..b3fd92928b6 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/datanode/DataNodeUtils.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/datanode/DataNodeUtils.java
@@ -46,6 +46,7 @@ public final class DataNodeUtils {
*
* @param text data node text
* @return data node
+ * @throws InvalidDataNodesFormatException invalid data nodes format exception
*/
public static DataNode parseWithSchema(final String text) {
List<String> segments = Splitter.on(".").splitToList(text);
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/ingest/position/PrimaryKeyPositionFactory.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/ingest/position/PrimaryKeyPositionFactory.java
index 6e8bbabf9bb..49804630373 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/ingest/position/PrimaryKeyPositionFactory.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/api/ingest/position/PrimaryKeyPositionFactory.java
@@ -32,6 +32,7 @@ public final class PrimaryKeyPositionFactory {
*
* @param data string data
* @return primary key position
+ * @throws IllegalArgumentException illegal argument exception
*/
public static IngestPosition<?> newInstance(final String data) {
List<String> parts = Splitter.on(',').splitToList(data);
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/ExecuteEngine.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/ExecuteEngine.java
index d17e9bf7d70..815058632f8 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/ExecuteEngine.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/execute/ExecuteEngine.java
@@ -88,6 +88,7 @@ public final class ExecuteEngine {
*
* @param futures futures
* @param executeCallback execute callback on all the futures
+ * @throws RuntimeException runtime exception
*/
public static void trigger(final Collection<CompletableFuture<?>> futures, final ExecuteCallback executeCallback) {
BlockingQueue<CompletableFuture<?>> futureQueue = new LinkedBlockingQueue<>();
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java
index 3544af0d962..d1275466685 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/importer/DataRecordMerger.java
@@ -121,7 +121,7 @@ public final class DataRecordMerger {
private void mergeDelete(final DataRecord dataRecord, final Map<DataRecord.Key, DataRecord> dataRecords) {
DataRecord beforeDataRecord = dataRecords.get(dataRecord.getKey());
ShardingSpherePreconditions.checkState(null == beforeDataRecord
- || (!IngestDataChangeType.DELETE.equals(beforeDataRecord.getType())), () -> new PipelineUnexpectedDataRecordOrderException(beforeDataRecord, dataRecord));
+ || !IngestDataChangeType.DELETE.equals(beforeDataRecord.getType()), () -> new PipelineUnexpectedDataRecordOrderException(beforeDataRecord, dataRecord));
if (null != beforeDataRecord && IngestDataChangeType.UPDATE.equals(beforeDataRecord.getType()) && checkUpdatedPrimaryKey(beforeDataRecord)) {
DataRecord mergedDataRecord = new DataRecord(dataRecord.getPosition(), dataRecord.getColumnCount());
for (int i = 0; i < dataRecord.getColumnCount(); i++) {
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
index 48165130515..c3b3b49ef08 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
@@ -85,6 +85,7 @@ public final class ManualBitSet {
* @param fromIndex from index
* @param size true bit size
* @return index
+ * @throws IndexOutOfBoundsException index out of bounds exception
*/
public synchronized long getEndIndex(final long fromIndex, final int size) {
if (0 == size) {
diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/DatabaseTypeUtils.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/DatabaseTypeUtils.java
index 578d59aaeb7..dc554af1ec5 100644
--- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/DatabaseTypeUtils.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/DatabaseTypeUtils.java
@@ -43,7 +43,7 @@ public final class DatabaseTypeUtils {
Collection<String> result = new LinkedList<>();
for (DatabaseType each : ShardingSphereServiceLoader.getServiceInstances(DatabaseType.class)) {
if (trunkDatabaseTypes.contains(each.getType())
- || (each instanceof BranchDatabaseType && trunkDatabaseTypes.contains(((BranchDatabaseType) each).getTrunkDatabaseType().getType()))) {
+ || each instanceof BranchDatabaseType && trunkDatabaseTypes.contains(((BranchDatabaseType) each).getTrunkDatabaseType().getType())) {
result.add(each.getType());
}
}
diff --git a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussPositionInitializer.java b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussPositionInitializer.java
index c2298259124..8e618a48929 100644
--- a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussPositionInitializer.java
+++ b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/ingest/OpenGaussPositionInitializer.java
@@ -61,6 +61,7 @@ public final class OpenGaussPositionInitializer implements PositionInitializer {
* Create logical replication slot if it does not exist.
*
* @param connection connection
+ * @param slotNameSuffix slotName suffix
* @throws SQLException SQL exception
*/
private void createSlotIfNotExist(final Connection connection, final String slotNameSuffix) throws SQLException {
diff --git a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/wal/WALEventConverter.java b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/wal/WALEventConverter.java
index ac5db47d1c0..7322765e45a 100644
--- a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/wal/WALEventConverter.java
+++ b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/ingest/wal/WALEventConverter.java
@@ -55,8 +55,9 @@ public final class WALEventConverter {
/**
* Convert WAL event to {@code Record}.
*
- * @param event of wal
+ * @param event WAL event
* @return record
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public Record convert(final AbstractWALEvent event) {
if (filter(event)) {
diff --git a/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java b/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java
index 5d81c81ce1b..2429e01439d 100644
--- a/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java
+++ b/kernel/data-pipeline/scenario/consistencycheck/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/consistencycheck/api/impl/ConsistencyCheckJobAPI.java
@@ -94,6 +94,7 @@ public final class ConsistencyCheckJobAPI extends AbstractPipelineJobAPIImpl {
*
* @param param create consistency check job parameter
* @return job id
+ * @throws UncompletedConsistencyCheckJobExistsException uncompleted consistency check job exists exception
*/
public String createJobAndStart(final CreateConsistencyCheckJobParameter param) {
GovernanceRepositoryAPI repositoryAPI = PipelineAPIFactory.getGovernanceRepositoryAPI();
diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java
index 5cf2b04547c..1a48d8050bd 100644
--- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java
+++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/SQLNodeConverterEngine.java
@@ -36,6 +36,7 @@ public final class SQLNodeConverterEngine {
*
* @param statement SQL statement to be converted
* @return sqlNode converted SQL node
+ * @throws OptimizationSQLNodeConvertException optimization SQL node convert exception
*/
public static SqlNode convert(final SQLStatement statement) {
if (statement instanceof SelectStatement) {
diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/segment/orderby/item/OrderByItemConverterUtils.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/segment/orderby/item/OrderByItemConverterUtils.java
index 6c85a9a73c3..49c8305b0bd 100644
--- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/segment/orderby/item/OrderByItemConverterUtils.java
+++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/converter/segment/orderby/item/OrderByItemConverterUtils.java
@@ -41,6 +41,7 @@ public final class OrderByItemConverterUtils {
*
* @param orderByItems order by items
* @return SQL nodes converted by order by item
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static Collection<SqlNode> convert(final Collection<OrderByItemSegment> orderByItems) {
Collection<SqlNode> result = new LinkedList<>();
diff --git a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/ParseRexNodeVisitorImpl.java b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/ParseRexNodeVisitorImpl.java
index e7a93a14f67..4d451a9ab2f 100644
--- a/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/ParseRexNodeVisitorImpl.java
+++ b/kernel/sql-federation/optimizer/src/main/java/org/apache/shardingsphere/sqlfederation/optimizer/metadata/translatable/ParseRexNodeVisitorImpl.java
@@ -296,15 +296,15 @@ public final class ParseRexNodeVisitorImpl extends ParseRexNodeBaseVisitor<RexNo
for (ArgRangeContext each : ctx.argRange()) {
BigDecimal lowerValue = BigDecimal.valueOf(Long.MIN_VALUE);
BigDecimal upperValue = BigDecimal.valueOf(Long.MAX_VALUE);
- if ((null != each.NEGETIVE_INFINITY_()) && (null != each.INTEGER_(0))) {
+ if (null != each.NEGETIVE_INFINITY_() && null != each.INTEGER_(0)) {
String upper = each.INTEGER_(0).getText();
upperValue = BigDecimal.valueOf(Long.parseLong(upper));
}
- if ((null != each.POSITIVE_INFINITY_()) && (null != each.INTEGER_(0))) {
+ if (null != each.POSITIVE_INFINITY_() && null != each.INTEGER_(0)) {
String lower = each.INTEGER_(0).getText();
lowerValue = BigDecimal.valueOf(Long.parseLong(lower));
}
- if ((null == each.NEGETIVE_INFINITY_()) && (null == each.POSITIVE_INFINITY_())) {
+ if (null == each.NEGETIVE_INFINITY_() && null == each.POSITIVE_INFINITY_()) {
String lower = each.INTEGER_(0).getText();
String upper = each.INTEGER_(1).getText();
lowerValue = BigDecimal.valueOf(Long.parseLong(lower));
diff --git a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/ConnectionTransaction.java b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/ConnectionTransaction.java
index 2531b6f1f80..d7fc460dae7 100644
--- a/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/ConnectionTransaction.java
+++ b/kernel/transaction/core/src/main/java/org/apache/shardingsphere/transaction/ConnectionTransaction.java
@@ -91,7 +91,7 @@ public final class ConnectionTransaction {
* @return hold transaction or not
*/
public boolean isHoldTransaction(final boolean autoCommit) {
- return (TransactionType.LOCAL == transactionType && !autoCommit) || (TransactionType.XA == transactionType && isInTransaction());
+ return TransactionType.LOCAL == transactionType && !autoCommit || TransactionType.XA == transactionType && isInTransaction();
}
/**
diff --git a/kernel/transaction/type/xa/core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java b/kernel/transaction/type/xa/core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
index f31eaf197cf..d8004825d80 100644
--- a/kernel/transaction/type/xa/core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
+++ b/kernel/transaction/type/xa/core/src/test/java/org/apache/shardingsphere/transaction/xa/fixture/DataSourceUtils.java
@@ -42,6 +42,7 @@ public final class DataSourceUtils {
* @param databaseType database type
* @param databaseName database name
* @return built data source
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static DataSource build(final Class<? extends DataSource> dataSourceClass, final DatabaseType databaseType, final String databaseName) {
if (HikariDataSource.class == dataSourceClass) {
diff --git a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/entity/ServiceMetaData.java b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/entity/ServiceMetaData.java
index 3038d62598b..75314a59b29 100644
--- a/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/entity/ServiceMetaData.java
+++ b/mode/type/cluster/repository/provider/nacos/src/main/java/org/apache/shardingsphere/mode/repository/cluster/nacos/entity/ServiceMetaData.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.mode.repository.cluster.nacos.entity;
+import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@@ -49,9 +50,7 @@ public final class ServiceMetaData {
*/
public int getPort() {
int result = port.incrementAndGet();
- if (result == Integer.MIN_VALUE) {
- throw new IllegalStateException("Specified cluster ip exceeded the maximum number of persisting");
- }
+ Preconditions.checkState(Integer.MIN_VALUE != result, "Specified cluster ip exceeded the maximum number of persisting");
return result;
}
}
diff --git a/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/handler/ZookeeperExceptionHandler.java b/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/handler/ZookeeperExceptionHandler.java
index f3a3b0746c1..dd852a96ab6 100644
--- a/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/handler/ZookeeperExceptionHandler.java
+++ b/mode/type/cluster/repository/provider/zookeeper/src/main/java/org/apache/shardingsphere/mode/repository/cluster/zookeeper/handler/ZookeeperExceptionHandler.java
@@ -38,6 +38,7 @@ public final class ZookeeperExceptionHandler {
* <p>Ignore interrupt and connection invalid exception.</p>
*
* @param cause to be handled exception
+ * @throws ClusterPersistRepositoryException cluster persist repository exception
*/
public static void handleException(final Exception cause) {
if (null == cause) {
diff --git a/pom.xml b/pom.xml
index 4af799204c8..05ae2ef84d8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,7 +136,7 @@
<cobertura-maven-plugin.version>2.7</cobertura-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.8</jacoco-maven-plugin.version>
<findbugs-maven-plugin.version>3.0.2</findbugs-maven-plugin.version>
- <maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
+ <maven-checkstyle-plugin.version>3.2.1</maven-checkstyle-plugin.version>
<maven-pmd-plugin.version>3.5</maven-pmd-plugin.version>
<jdepend-maven-plugin.version>2.0</jdepend-maven-plugin.version>
<taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutor.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutor.java
index a117cc5f4e7..9a5781e9f35 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutor.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/ProxySQLExecutor.java
@@ -39,6 +39,7 @@ import org.apache.shardingsphere.infra.executor.sql.prepare.driver.jdbc.Statemen
import org.apache.shardingsphere.infra.executor.sql.prepare.raw.RawExecutionPrepareEngine;
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.infra.rule.identifier.type.RawExecutionRule;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.util.spi.ShardingSphereServiceLoader;
import org.apache.shardingsphere.infra.util.spi.type.typed.TypedSPILoader;
import org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.ProxyJDBCExecutor;
@@ -98,13 +99,12 @@ public final class ProxySQLExecutor {
* @param executionContext execution context
*/
public void checkExecutePrerequisites(final ExecutionContext executionContext) {
- if (isExecuteDDLInXATransaction(executionContext.getSqlStatementContext().getSqlStatement())
- || isExecuteDDLInPostgreSQLOpenGaussTransaction(executionContext.getSqlStatementContext().getSqlStatement())) {
- String tableName = executionContext.getSqlStatementContext() instanceof TableAvailable && !((TableAvailable) executionContext.getSqlStatementContext()).getAllTables().isEmpty()
- ? ((TableAvailable) executionContext.getSqlStatementContext()).getAllTables().iterator().next().getTableName().getIdentifier().getValue()
- : "unknown_table";
- throw new TableModifyInTransactionException(tableName);
- }
+ ShardingSpherePreconditions.checkState(isValidExecutePrerequisites(executionContext), () -> new TableModifyInTransactionException(getTableName(executionContext)));
+ }
+
+ private boolean isValidExecutePrerequisites(final ExecutionContext executionContext) {
+ return !isExecuteDDLInXATransaction(executionContext.getSqlStatementContext().getSqlStatement())
+ && !isExecuteDDLInPostgreSQLOpenGaussTransaction(executionContext.getSqlStatementContext().getSqlStatement());
}
private boolean isExecuteDDLInXATransaction(final SQLStatement sqlStatement) {
@@ -139,6 +139,12 @@ public final class ProxySQLExecutor {
return sqlStatement instanceof PostgreSQLStatement || sqlStatement instanceof OpenGaussStatement;
}
+ private static String getTableName(final ExecutionContext executionContext) {
+ return executionContext.getSqlStatementContext() instanceof TableAvailable && !((TableAvailable) executionContext.getSqlStatementContext()).getAllTables().isEmpty()
+ ? ((TableAvailable) executionContext.getSqlStatementContext()).getAllTables().iterator().next().getTableName().getIdentifier().getValue()
+ : "unknown_table";
+ }
+
/**
* Execute SQL.
*
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
index 4b95dc5545a..decf0877cb6 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/connector/jdbc/executor/callback/ProxyJDBCExecutorCallbackFactory.java
@@ -47,6 +47,7 @@ public final class ProxyJDBCExecutorCallbackFactory {
* @param isExceptionThrown is exception thrown or not
* @param isFetchMetaData is fetch meta data or not
* @return created instance
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static ProxyJDBCExecutorCallback newInstance(final String type, final DatabaseType protocolType, final Map<String, DatabaseType> storageTypes, final SQLStatement sqlStatement,
final DatabaseConnector databaseConnector, final boolean isReturnGeneratedKeys, final boolean isExceptionThrown,
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
index 2bf7d74b929..153fd446930 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/context/ProxyContext.java
@@ -24,6 +24,7 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.dialect.exception.syntax.database.NoDatabaseSelectedException;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.infra.state.instance.InstanceStateContext;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.connector.jdbc.datasource.JDBCBackendDataSource;
@@ -79,9 +80,7 @@ public final class ProxyContext {
* @return got database
*/
public ShardingSphereDatabase getDatabase(final String name) {
- if (Strings.isNullOrEmpty(name) || !contextManager.getMetaDataContexts().getMetaData().containsDatabase(name)) {
- throw new NoDatabaseSelectedException();
- }
+ ShardingSpherePreconditions.checkState(!Strings.isNullOrEmpty(name) && contextManager.getMetaDataContexts().getMetaData().containsDatabase(name), NoDatabaseSelectedException::new);
return contextManager.getMetaDataContexts().getMetaData().getDatabase(name);
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/cdc/CDCBackendHandler.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/cdc/CDCBackendHandler.java
index 152b7f5a01c..66c6cee7163 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/cdc/CDCBackendHandler.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/cdc/CDCBackendHandler.java
@@ -50,6 +50,7 @@ import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.OneOffJobBoo
import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
import org.apache.shardingsphere.infra.datanode.DataNode;
import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.sharding.rule.ShardingRule;
import java.sql.SQLException;
@@ -83,9 +84,7 @@ public final class CDCBackendHandler {
*/
public CDCResponse streamData(final String requestId, final StreamDataRequestBody requestBody, final CDCConnectionContext connectionContext, final Channel channel) {
ShardingSphereDatabase database = PipelineContext.getContextManager().getMetaDataContexts().getMetaData().getDatabase(requestBody.getDatabase());
- if (null == database) {
- throw new CDCExceptionWrapper(requestId, new CDCServerException(String.format("%s database is not exists", requestBody.getDatabase())));
- }
+ ShardingSpherePreconditions.checkNotNull(database, () -> new CDCExceptionWrapper(requestId, new CDCServerException(String.format("%s database is not exists", requestBody.getDatabase()))));
Map<String, Set<String>> schemaTableNameMap;
Collection<String> tableNames;
Set<String> schemaTableNames = new HashSet<>();
@@ -99,9 +98,7 @@ public final class CDCBackendHandler {
.collect(Collectors.toList())));
tableNames = schemaTableNames;
}
- if (tableNames.isEmpty()) {
- throw new CDCExceptionWrapper(requestId, new NotFindStreamDataSourceTableException());
- }
+ ShardingSpherePreconditions.checkState(!tableNames.isEmpty(), () -> new CDCExceptionWrapper(requestId, new NotFindStreamDataSourceTableException()));
ShardingRule shardingRule = database.getRuleMetaData().getSingleRule(ShardingRule.class);
Map<String, List<DataNode>> actualDataNodesMap = new HashMap<>();
// TODO need support case-insensitive later
@@ -135,9 +132,7 @@ public final class CDCBackendHandler {
*/
public void startStreaming(final String jobId, final CDCConnectionContext connectionContext, final Channel channel) {
CDCJobConfiguration cdcJobConfig = jobAPI.getJobConfiguration(jobId);
- if (null == cdcJobConfig) {
- throw new PipelineJobNotFoundException(jobId);
- }
+ ShardingSpherePreconditions.checkNotNull(cdcJobConfig, () -> new PipelineJobNotFoundException(jobId));
if (PipelineJobCenter.isJobExisting(jobId)) {
PipelineJobCenter.stop(jobId);
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/DatabaseBackendHandlerFactory.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/DatabaseBackendHandlerFactory.java
index c1b9ac69850..c8fd12bd095 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/DatabaseBackendHandlerFactory.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/data/DatabaseBackendHandlerFactory.java
@@ -54,7 +54,7 @@ public final class DatabaseBackendHandlerFactory {
if (sqlStatement instanceof SetStatement && null == connectionSession.getDatabaseName()) {
return () -> new UpdateResponseHeader(sqlStatement);
}
- if (sqlStatement instanceof DALStatement || (sqlStatement instanceof SelectStatement && null == ((SelectStatement) sqlStatement).getFrom())) {
+ if (sqlStatement instanceof DALStatement || sqlStatement instanceof SelectStatement && null == ((SelectStatement) sqlStatement).getFrom()) {
return new UnicastDatabaseBackendHandler(queryContext, connectionSession);
}
return DatabaseConnectorFactory.getInstance().newInstance(queryContext, connectionSession.getBackendConnection(), preferPreparedStatement);
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
index b2db8eb1d94..31987b287a9 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/DistSQLBackendHandlerFactory.java
@@ -44,6 +44,7 @@ public final class DistSQLBackendHandlerFactory {
* @param sqlStatement DistSQL statement
* @param connectionSession connection session
* @return proxy backend handler
+ * @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static ProxyBackendHandler newInstance(final DistSQLStatement sqlStatement, final ConnectionSession connectionSession) {
if (sqlStatement instanceof RQLStatement) {
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/enums/VariableEnum.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/enums/VariableEnum.java
index 07e69b848a7..4e4b8a57ca7 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/enums/VariableEnum.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/enums/VariableEnum.java
@@ -35,6 +35,7 @@ public enum VariableEnum {
*
* @param variableName variable name
* @return variable constant
+ * @throws UnsupportedVariableException unsupported variable exception
*/
public static VariableEnum getValueOf(final String variableName) {
try {
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/transaction/TransactionStatus.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/transaction/TransactionStatus.java
index 4ed595a20fa..ef3d9c7a5f9 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/transaction/TransactionStatus.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/session/transaction/TransactionStatus.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.proxy.backend.session.transaction;
import lombok.Getter;
import lombok.Setter;
+import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
import org.apache.shardingsphere.transaction.api.TransactionType;
import org.apache.shardingsphere.transaction.exception.SwitchTypeInTransactionException;
@@ -46,9 +47,7 @@ public final class TransactionStatus {
* @param transactionType transaction type
*/
public void setTransactionType(final TransactionType transactionType) {
- if (inTransaction) {
- throw new SwitchTypeInTransactionException();
- }
+ ShardingSpherePreconditions.checkState(!inTransaction, SwitchTypeInTransactionException::new);
this.transactionType = transactionType;
}
diff --git a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
index 30237c86e63..c3b6f0a3fb3 100644
--- a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
+++ b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/util/ExportUtils.java
@@ -54,6 +54,7 @@ public final class ExportUtils {
*
* @param filePath file path
* @param exportedData exported configuration data
+ * @throws FileIOException file IO exception
*/
@SuppressWarnings("ResultOfMethodCallIgnored")
public static void exportToFile(final String filePath, final String exportedData) {
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java
index e36b3608c90..80cc8f7d7c0 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/context/HBaseRegionWarmUpContext.java
@@ -79,6 +79,7 @@ public final class HBaseRegionWarmUpContext {
*
* @param tableName table name
* @param connection HBase connection
+ * @throws HBaseOperationException HBase operation exception
*/
public void loadRegionInfo(final String tableName, final Connection connection) {
HBaseRegionWarmUpContext.getInstance().addExecuteCount();
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java
index c9bbbf947fc..f94fee477ed 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/converter/HBaseOperationConverterFactory.java
@@ -43,6 +43,7 @@ public final class HBaseOperationConverterFactory {
*
* @param sqlStatementContext SQL statement context
* @return instance of converter
+ * @throws HBaseOperationException HBase operation exception
*/
public static HBaseOperationConverter newInstance(final SQLStatementContext<?> sqlStatementContext) {
if (sqlStatementContext instanceof SelectStatementContext) {
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/executor/HBaseExecutor.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/executor/HBaseExecutor.java
index 4a636d5492a..cc69b115c09 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/executor/HBaseExecutor.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/executor/HBaseExecutor.java
@@ -46,6 +46,7 @@ public final class HBaseExecutor {
*
* @param tableName table name
* @param operation operation
+ * @throws HBaseOperationException HBase operation exception
*/
public static void executeUpdate(final String tableName, final HBaseUpdateCallback operation) {
TableName backendTableName = TableName.valueOf(tableName);
@@ -71,6 +72,7 @@ public final class HBaseExecutor {
* @param operation operation
* @param <T> type of result
* @return query result
+ * @throws HBaseOperationException HBase operation exception
*/
public static <T> T executeQuery(final String tableName, final HBaseQueryCallback<T> operation) {
TableName backendTableName = TableName.valueOf(tableName);
@@ -92,6 +94,7 @@ public final class HBaseExecutor {
* @param operation operation
* @param <T> type of result
* @return admin result
+ * @throws HBaseOperationException HBase operation exception
*/
public static <T> T executeAdmin(final Connection connection, final HBaseAdminCallback<T> operation) {
try (Admin admin = connection.getAdmin()) {
diff --git a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
index 1fa04e83f66..20954e8fee7 100644
--- a/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
+++ b/proxy/backend/type/hbase/src/main/java/org/apache/shardingsphere/proxy/backend/hbase/util/HBaseHeterogeneousUtils.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.proxy.backend.hbase.util;
+import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.binder.segment.select.projection.impl.ShorthandProjection;
@@ -64,9 +65,7 @@ public final class HBaseHeterogeneousUtils {
StringBuffer sb = new StringBuffer();
while (matcher.find()) {
found++;
- if (found > replacements.length) {
- throw new IllegalArgumentException(String.format("Missing replacement for '%s' at [%s].", target, found));
- }
+ Preconditions.checkState(found <= replacements.length, String.format("Missing replacement for '%s' at [%s].", target, found));
matcher.appendReplacement(sb, Matcher.quoteReplacement(replacements[found - 1].toString()));
}
matcher.appendTail(sb);
diff --git a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
index 8bc638744fd..6a949e63ac4 100644
--- a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
+++ b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
@@ -46,6 +46,7 @@ public final class BootstrapArguments {
* Get port.
*
* @return port
+ * @throws IllegalArgumentException illegal argument exception
*/
public Optional<Integer> getPort() {
if (0 == args.length) {
diff --git a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/Portal.java b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/Portal.java
index fa4a140be9c..0c4ac96902b 100644
--- a/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/Portal.java
+++ b/proxy/frontend/type/postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/extended/Portal.java
@@ -107,6 +107,7 @@ public final class Portal {
* Describe portal.
*
* @return portal description packet
+ * @throws IllegalStateException illegal state exception
*/
public PostgreSQLPacket describe() {
if (responseHeader instanceof QueryResponseHeader) {
diff --git a/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java b/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
index 9b69d860533..23fbb59897d 100644
--- a/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
+++ b/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
@@ -42,6 +42,7 @@ public final class SQLParserExecutor {
*
* @param sql SQL to be parsed
* @return parse AST node
+ * @throws SQLParsingException SQL parsing exception
*/
public ParseASTNode parse(final String sql) {
ParseASTNode result = twoPhaseParse(sql);
diff --git a/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 3ebbe755ff6..eab0cdbb134 100644
--- a/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ b/sql-parser/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -673,6 +673,7 @@ public enum SQLVisitorRule {
*
* @param parseTreeClass parse tree class
* @return visitor rule
+ * @throws SQLASTVisitorException SQL AST visitor exception
*/
public static SQLVisitorRule valueOf(final Class<? extends ParseTree> parseTreeClass) {
String parseTreeClassName = parseTreeClass.getSimpleName();
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 0a948a0eae3..5e9062c55d8 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -35,6 +35,11 @@
<module name="UniqueProperties" />
<module name="SeverityMatchFilter" />
+ <module name="LineLength">
+ <property name="fileExtensions" value="java"/>
+ <property name="max" value="200" />
+ </module>
+
<module name="TreeWalker">
<!-- Naming Conventions -->
@@ -60,9 +65,6 @@
<!-- Size Violations -->
<module name="AnonInnerLength" />
<module name="MethodLength" />
- <module name="LineLength">
- <property name="max" value="200" />
- </module>
<module name="MethodCount" />
<module name="ExecutableStatementCount">
<property name="max" value="50" />
@@ -122,7 +124,6 @@
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports" />
- <module name="CustomImportOrder" />
<!-- Annotations -->
<module name="AnnotationLocation">
@@ -235,6 +236,7 @@
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated" />
</module>
+ <module name="InvalidJavadocPosition" />
<module name="NonEmptyAtclauseDescription" />
<module name="JavadocParagraph" />
<module name="JavadocStyle" />
@@ -247,9 +249,8 @@
</module>
-->
<module name="JavadocMethod">
- <property name="scope" value="public" />
<property name="allowedAnnotations" value="Override, Test, BeforeEach, AfterEach, BeforeAll, AfterAll, ParameterizedTest" />
- <property name="ignoreMethodNamesRegex" value="^assert.*$|^verify.*$" />
+ <property name="validateThrows" value="true" />
<property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF" />
</module>
diff --git a/src/resources/checkstyle_ci.xml b/src/resources/checkstyle_ci.xml
index a14b7f11056..eaf4e6f29d7 100644
--- a/src/resources/checkstyle_ci.xml
+++ b/src/resources/checkstyle_ci.xml
@@ -35,6 +35,11 @@
<module name="UniqueProperties" />
<module name="SeverityMatchFilter" />
+ <module name="LineLength">
+ <property name="fileExtensions" value="java"/>
+ <property name="max" value="200" />
+ </module>
+
<module name="TreeWalker">
<!-- Naming Conventions -->
@@ -60,9 +65,6 @@
<!-- Size Violations -->
<module name="AnonInnerLength" />
<module name="MethodLength" />
- <module name="LineLength">
- <property name="max" value="200" />
- </module>
<module name="OuterTypeNumber" />
<!-- Whitespace -->
@@ -117,7 +119,6 @@
<module name="IllegalImport" />
<module name="RedundantImport" />
<module name="UnusedImports" />
- <module name="CustomImportOrder" />
<!-- Annotations -->
<module name="AnnotationLocation">
@@ -220,6 +221,7 @@
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated" />
</module>
+ <module name="InvalidJavadocPosition" />
<module name="NonEmptyAtclauseDescription" />
<module name="JavadocParagraph" />
<module name="JavadocStyle" />
@@ -228,9 +230,8 @@
<module name="SummaryJavadoc" />
<module name="JavadocMethod">
- <property name="scope" value="public" />
<property name="allowedAnnotations" value="Override, Test, BeforeEach, AfterEach, BeforeAll, AfterAll, ParameterizedTest" />
- <property name="ignoreMethodNamesRegex" value="^assert.*$|^verify.*$" />
+ <property name="validateThrows" value="true" />
<property name="tokens" value="METHOD_DEF, ANNOTATION_FIELD_DEF" />
</module>
diff --git a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/EnvironmentProperties.java b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/EnvironmentProperties.java
index db272460d4a..c63ff842ba4 100644
--- a/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/EnvironmentProperties.java
+++ b/test/e2e/agent/plugins/common/src/test/java/org/apache/shardingsphere/test/e2e/agent/common/env/EnvironmentProperties.java
@@ -35,6 +35,7 @@ public final class EnvironmentProperties {
*
* @param propsFileName properties file name
* @return properties
+ * @throws RuntimeException runtime exception
*/
@SuppressWarnings("AccessOfSystemProperties")
public static Properties loadProperties(final String propsFileName) {
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/AdapterContainerFactory.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/AdapterContainerFactory.java
index 89bcf1a7ad7..afe63fb0fd5 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/AdapterContainerFactory.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/AdapterContainerFactory.java
@@ -44,6 +44,7 @@ public final class AdapterContainerFactory {
* @param scenario scenario
* @param containerConfig adaptor container configuration
* @return created instance
+ * @throws RuntimeException runtime exception
*/
public static AdapterContainer newInstance(final AdapterMode mode, final AdapterType adapter, final DatabaseType databaseType,
final StorageContainer storageContainer, final String scenario, final AdaptorContainerConfiguration containerConfig) {
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/governance/GovernanceContainerFactory.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/governance/GovernanceContainerFactory.java
index f2ec05d9e30..a20aeec0add 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/governance/GovernanceContainerFactory.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/governance/GovernanceContainerFactory.java
@@ -32,6 +32,7 @@ public final class GovernanceContainerFactory {
*
* @param type governance center type
* @return created instance
+ * @throws RuntimeException runtime exception
*/
@SuppressWarnings("SwitchStatementWithTooFewBranches")
public static GovernanceContainer newInstance(final String type) {
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
index 6d6da53098e..dd0bfb4c9c3 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/StorageContainerFactory.java
@@ -40,6 +40,7 @@ public final class StorageContainerFactory {
* @param scenario scenario
* @param storageContainerConfiguration storage container configuration
* @return created instance
+ * @throws RuntimeException runtime exception
*/
public static StorageContainer newInstance(final DatabaseType databaseType, final String storageContainerImage, final String scenario,
final StorageContainerConfiguration storageContainerConfiguration) {
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
index b3fb81e06ed..d1289d74c63 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/storage/config/impl/StorageContainerConfigurationFactory.java
@@ -37,6 +37,7 @@ public final class StorageContainerConfigurationFactory {
*
* @param databaseType database type
* @return created instance
+ * @throws RuntimeException runtime exception
*/
public static StorageContainerConfiguration newInstance(final DatabaseType databaseType) {
switch (databaseType.getType()) {
diff --git a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/DataSourceEnvironment.java b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/DataSourceEnvironment.java
index 764dcc8b986..810e2203e96 100644
--- a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/DataSourceEnvironment.java
+++ b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/DataSourceEnvironment.java
@@ -29,6 +29,7 @@ public final class DataSourceEnvironment {
*
* @param databaseType database type
* @return driver class name
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static String getDriverClassName(final DatabaseType databaseType) {
switch (databaseType.getType()) {
@@ -56,6 +57,7 @@ public final class DataSourceEnvironment {
* @param host database host
* @param port database port
* @return URL
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static String getURL(final DatabaseType databaseType, final String host, final int port) {
switch (databaseType.getType()) {
@@ -84,6 +86,7 @@ public final class DataSourceEnvironment {
* @param port database port
* @param dataSourceName data source name
* @return URL
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static String getURL(final DatabaseType databaseType, final String host, final int port, final String dataSourceName) {
switch (databaseType.getType()) {
diff --git a/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/cases/DatabaseClusterEnvironmentFactory.java b/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/cases/DatabaseClusterEnvironmentFactory.java
index c90066c0d23..7211a55a806 100644
--- a/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/cases/DatabaseClusterEnvironmentFactory.java
+++ b/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/cases/DatabaseClusterEnvironmentFactory.java
@@ -38,11 +38,12 @@ public final class DatabaseClusterEnvironmentFactory {
* @param dataSources storage data sources
* @return Database cluster environment instance
* @throws SQLException SQL exception
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static DatabaseClusterEnvironment newInstance(final String environment, final List<DataSource> dataSources) throws SQLException {
if ("MySQL.MGR".equals(environment)) {
return new MySQLMGREnvironment(dataSources);
}
- throw new UnsupportedOperationException("Unsupported database environment : " + environment);
+ throw new UnsupportedOperationException(String.format("Unsupported database environment: `%s`", environment));
}
}
diff --git a/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/env/DiscoveryE2ETestEnvironment.java b/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/env/DiscoveryE2ETestEnvironment.java
index 96ee31d2054..bdb920f13fc 100644
--- a/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/env/DiscoveryE2ETestEnvironment.java
+++ b/test/e2e/operation/discovery/src/test/java/org/apache/shardingsphere/test/e2e/discovery/env/DiscoveryE2ETestEnvironment.java
@@ -75,11 +75,12 @@ public final class DiscoveryE2ETestEnvironment {
*
* @param databaseType database type
* @return storage container images
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public List<String> listStorageContainerImages(final DatabaseType databaseType) {
if ("MySQL".equals(databaseType.getType())) {
return mysqlVersions;
}
- throw new UnsupportedOperationException("Unsupported database type: " + databaseType.getType());
+ throw new UnsupportedOperationException(String.format("Unsupported database type: `%s`", databaseType.getType()));
}
}
diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
index 1bd111992c9..036ac685976 100644
--- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
+++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
@@ -379,6 +379,7 @@ public final class PipelineContainerComposer implements AutoCloseable {
*
* @param sql SQL
* @return query result
+ * @throws RuntimeException runtime exception
*/
@SneakyThrows(InterruptedException.class)
public List<Map<String, Object>> queryForListWithLog(final String sql) {
diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
index cafd64d837f..36eac3df0c1 100644
--- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
+++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
@@ -72,8 +72,9 @@ public final class PipelineE2EEnvironment {
/**
* Get actual data source connection.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return jdbc connection
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public int getActualDatabasePort(final DatabaseType databaseType) {
switch (databaseType.getType()) {
@@ -91,8 +92,9 @@ public final class PipelineE2EEnvironment {
/**
* Get actual data source default port.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return default port
+ * @throws IllegalArgumentException illegal argument exception
*/
public int getActualDataSourceDefaultPort(final DatabaseType databaseType) {
switch (databaseType.getType()) {
@@ -119,7 +121,7 @@ public final class PipelineE2EEnvironment {
/**
* Get actual data source username.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return actual data source username
*/
public String getActualDataSourceUsername(final DatabaseType databaseType) {
@@ -129,7 +131,7 @@ public final class PipelineE2EEnvironment {
/**
* Get actual data source password.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return actual data source username
*/
public String getActualDataSourcePassword(final DatabaseType databaseType) {
@@ -148,8 +150,9 @@ public final class PipelineE2EEnvironment {
/**
* List storage container images.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return database storage container images
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public List<String> listStorageContainerImages(final DatabaseType databaseType) {
// Native mode needn't use docker image, just return a list which contain one item
diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
index 22f20f386cf..f0709ec4ca2 100644
--- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
+++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
@@ -69,7 +69,8 @@ public final class PipelineCaseHelper {
* @param databaseType database type
* @param keyGenerateAlgorithm key generate algorithm
* @param insertRows insert rows
- * @return order insert data.
+ * @return order insert data
+ * @throws UnsupportedOperationException Unsupported operation exception
*/
public static List<Object[]> generateOrderInsertData(final DatabaseType databaseType, final KeyGenerateAlgorithm keyGenerateAlgorithm, final int insertRows) {
List<Object[]> result = new ArrayList<>(insertRows);
diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/DataSourceExecuteUtils.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/DataSourceExecuteUtils.java
index 7703c002d4a..37f8a5002ce 100644
--- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/DataSourceExecuteUtils.java
+++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/DataSourceExecuteUtils.java
@@ -37,6 +37,7 @@ public final class DataSourceExecuteUtils {
*
* @param dataSource data source
* @param sql SQL
+ * @throws RuntimeException runtime exception
*/
public static void execute(final DataSource dataSource, final String sql) {
try (Connection connection = dataSource.getConnection()) {
@@ -52,6 +53,7 @@ public final class DataSourceExecuteUtils {
* @param dataSource data source
* @param sql SQL
* @param parameters parameters
+ * @throws RuntimeException runtime exception
*/
public static void execute(final DataSource dataSource, final String sql, final Object[] parameters) {
try (Connection connection = dataSource.getConnection()) {
@@ -71,6 +73,7 @@ public final class DataSourceExecuteUtils {
* @param dataSource data source
* @param sql SQL
* @param parameters parameters
+ * @throws RuntimeException runtime exception
*/
public static void execute(final DataSource dataSource, final String sql, final List<Object[]> parameters) {
try (Connection connection = dataSource.getConnection()) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
index 44aeed811ab..a69c35e689e 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/MySQLAutoCommitTestCase.java
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* MySQL auto commit transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, transactionTypes = TransactionType.LOCAL)
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL, transactionTypes = TransactionType.LOCAL)
public final class MySQLAutoCommitTestCase extends BaseTransactionTestCase {
public MySQLAutoCommitTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
index 8ff61f54578..accd89381f1 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/autocommit/PostgreSQLAutoCommitTestCase.java
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* PostgreSQL auto commit transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL}, transactionTypes = TransactionType.LOCAL)
+@TransactionTestCase(dbTypes = TransactionTestConstants.POSTGRESQL, transactionTypes = TransactionType.LOCAL)
public final class PostgreSQLAutoCommitTestCase extends BaseTransactionTestCase {
public PostgreSQLAutoCommitTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
index d29debcb89d..bc60cb2fd81 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/commitrollback/MultiJDBCConnectionsTestCase.java
@@ -32,7 +32,7 @@ import java.sql.SQLException;
/**
* Multiple jdbc connections in one thread test case.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, transactionTypes = TransactionType.XA)
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL, transactionTypes = TransactionType.XA)
public final class MultiJDBCConnectionsTestCase extends BaseTransactionTestCase {
public MultiJDBCConnectionsTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/cursor/OpenGaussCursorTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/cursor/OpenGaussCursorTestCase.java
index 76995f8fdcb..8d58c750be0 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/cursor/OpenGaussCursorTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/cursor/OpenGaussCursorTestCase.java
@@ -40,7 +40,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* OpenGauss cursor transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.OPENGAUSS}, adapters = TransactionTestConstants.PROXY, scenario = "cursor")
+@TransactionTestCase(dbTypes = TransactionTestConstants.OPENGAUSS, adapters = TransactionTestConstants.PROXY, scenario = "cursor")
@Slf4j
public final class OpenGaussCursorTestCase extends BaseTransactionTestCase {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/MySQLSetReadOnlyTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/MySQLSetReadOnlyTestCase.java
index c6cbc7c32af..4bd16dea2b9 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/MySQLSetReadOnlyTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/MySQLSetReadOnlyTestCase.java
@@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* MySQL set read only transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL})
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL)
@Slf4j
public final class MySQLSetReadOnlyTestCase extends SetReadOnlyTestCase {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/PostgreSQLSetReadOnlyTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/PostgreSQLSetReadOnlyTestCase.java
index db1120dfa79..cca197c8545 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/PostgreSQLSetReadOnlyTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/readonly/PostgreSQLSetReadOnlyTestCase.java
@@ -32,7 +32,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* PostgreSQL set read only transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL})
+@TransactionTestCase(dbTypes = TransactionTestConstants.POSTGRESQL)
@Slf4j
public final class PostgreSQLSetReadOnlyTestCase extends SetReadOnlyTestCase {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/MySQLSavePointTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/MySQLSavePointTestCase.java
index a1a3d5e7671..e0ab9724fac 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/MySQLSavePointTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/MySQLSavePointTestCase.java
@@ -28,7 +28,7 @@ import java.sql.SQLException;
/**
* MySQL savepoint transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL})
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL)
public final class MySQLSavePointTestCase extends BaseSavePointTestCase {
public MySQLSavePointTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/OpenGaussSavePointTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/OpenGaussSavePointTestCase.java
index 611f7e2b8fd..9300e663407 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/OpenGaussSavePointTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/OpenGaussSavePointTestCase.java
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* OpenGauss savepoint transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.OPENGAUSS})
+@TransactionTestCase(dbTypes = TransactionTestConstants.OPENGAUSS)
public final class OpenGaussSavePointTestCase extends BaseSavePointTestCase {
public OpenGaussSavePointTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
index db287b7ed29..542e81f87fd 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java
@@ -36,7 +36,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* PostgreSQL savepoint transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL})
+@TransactionTestCase(dbTypes = TransactionTestConstants.POSTGRESQL)
public final class PostgreSQLSavePointTestCase extends BaseSavePointTestCase {
public PostgreSQLSavePointTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLLocalTruncateTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLLocalTruncateTestCase.java
index ec52db3d729..32147926e67 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLLocalTruncateTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLLocalTruncateTestCase.java
@@ -31,7 +31,7 @@ import java.sql.SQLException;
/**
* MySQL truncate local transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, transactionTypes = {TransactionType.LOCAL})
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL, transactionTypes = TransactionType.LOCAL)
public final class MySQLLocalTruncateTestCase extends BaseTransactionTestCase {
public MySQLLocalTruncateTestCase(final TransactionBaseE2EIT baseTransactionITCase, final DataSource dataSource) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLXATruncateTestCase.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLXATruncateTestCase.java
index 29134ef484e..f7f572c11e5 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLXATruncateTestCase.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/cases/truncate/MySQLXATruncateTestCase.java
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.fail;
/**
* MySQL truncate XA transaction integration test.
*/
-@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL}, adapters = TransactionTestConstants.PROXY, transactionTypes = {TransactionType.XA})
+@TransactionTestCase(dbTypes = TransactionTestConstants.MYSQL, adapters = TransactionTestConstants.PROXY, transactionTypes = TransactionType.XA)
@Slf4j
public final class MySQLXATruncateTestCase extends BaseTransactionTestCase {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
index 6ee5ac9be0e..aaa14527008 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/env/TransactionE2EEnvironment.java
@@ -103,8 +103,9 @@ public final class TransactionE2EEnvironment {
/**
* Get actual data source default port.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return default port
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public int getActualDataSourceDefaultPort(final DatabaseType databaseType) {
switch (databaseType.getType()) {
@@ -115,7 +116,7 @@ public final class TransactionE2EEnvironment {
case "openGauss":
return Integer.parseInt(props.getOrDefault("transaction.it.native.opengauss.port", OpenGaussContainer.OPENGAUSS_EXPOSED_PORT).toString());
default:
- throw new IllegalArgumentException("Unsupported database type: " + databaseType.getType());
+ throw new UnsupportedOperationException(String.format("Unsupported database type: `%s`", databaseType.getType()));
}
}
@@ -131,7 +132,7 @@ public final class TransactionE2EEnvironment {
/**
* Get actual data source username.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return actual data source username
*/
public String getActualDataSourceUsername(final DatabaseType databaseType) {
@@ -143,7 +144,7 @@ public final class TransactionE2EEnvironment {
/**
* Get actual data source password.
*
- * @param databaseType database type.
+ * @param databaseType database type
* @return actual data source username
*/
public String getActualDataSourcePassword(final DatabaseType databaseType) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/StorageContainerConfigurationFactory.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/StorageContainerConfigurationFactory.java
index 359de71391e..fda192bbd80 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/StorageContainerConfigurationFactory.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/config/StorageContainerConfigurationFactory.java
@@ -37,6 +37,7 @@ public final class StorageContainerConfigurationFactory {
*
* @param databaseType database type
* @return created instance
+ * @throws RuntimeException runtime exception
*/
public static StorageContainerConfiguration newInstance(final DatabaseType databaseType) {
switch (databaseType.getType()) {
diff --git a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
index 9814f7d7012..e2388050674 100644
--- a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
+++ b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/transaction/framework/container/jdbc/ShardingSphereJDBCContainer.java
@@ -52,6 +52,7 @@ public final class ShardingSphereJDBCContainer implements EmbeddedITContainer {
* Get target data source.
*
* @return target data source
+ * @throws RuntimeException runtime exception
*/
public DataSource getTargetDataSource() {
DataSource dataSource = targetDataSourceProvider.get();
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/table/TableAssert.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/table/TableAssert.java
index b12a2b47fe7..9a52ee314e0 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/table/TableAssert.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/asserts/segment/table/TableAssert.java
@@ -61,6 +61,7 @@ public final class TableAssert {
* @param assertContext assert context
* @param actual actual tables
* @param expected expected tables
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static void assertIs(final SQLCaseAssertContext assertContext, final TableSegment actual, final ExpectedTable expected) {
if (actual instanceof JoinTableSegment) {
@@ -72,8 +73,7 @@ public final class TableAssert {
} else if (actual instanceof XmlTableSegment) {
assertIs(assertContext, (XmlTableSegment) actual, expected.getXmlTable());
} else {
- throw new UnsupportedOperationException(
- String.format("Unsupported table segment type `%s`.", actual.getClass()));
+ throw new UnsupportedOperationException(String.format("Unsupported table segment type `%s`.", actual.getClass()));
}
}
diff --git a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/sql/type/CaseTypedSQLBuilderFactory.java b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/sql/type/CaseTypedSQLBuilderFactory.java
index ad377536929..52b43aed26a 100644
--- a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/sql/type/CaseTypedSQLBuilderFactory.java
+++ b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/sql/type/CaseTypedSQLBuilderFactory.java
@@ -33,6 +33,7 @@ public final class CaseTypedSQLBuilderFactory {
*
* @param caseType SQL case type
* @return created instance
+ * @throws UnsupportedOperationException unsupported operation exception
*/
public static CaseTypedSQLBuilder newInstance(final SQLCaseType caseType) {
switch (caseType) {
diff --git a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java
index cc044769eec..8b0af75c343 100644
--- a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java
+++ b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/engine/SQLRewriterIT.java
@@ -94,7 +94,7 @@ public abstract class SQLRewriterIT {
@ParameterizedTest(name = "{0}")
@ArgumentsSource(TestCaseArgumentsProvider.class)
- public final void assertRewrite(final SQLRewriteEngineTestParameters testParams) throws IOException, SQLException {
+ void assertRewrite(final SQLRewriteEngineTestParameters testParams) throws IOException, SQLException {
Collection<SQLRewriteUnit> actual = createSQLRewriteUnits(testParams);
assertThat(actual.size(), is(testParams.getOutputSQLs().size()));
int count = 0;