This is an automated email from the ASF dual-hosted git repository.
totalo 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 56800a6ba42 Optimize code according to code analyze (#19952)
56800a6ba42 is described below
commit 56800a6ba422dfdf77b3e022aef9b1e8213f14de
Author: Raigor <[email protected]>
AuthorDate: Mon Aug 8 09:00:03 2022 +0800
Optimize code according to code analyze (#19952)
---
.../command/query/text/MySQLTextResultSetRowPacketTest.java | 3 ++-
.../validator/ddl/impl/ShardingDropTableStatementValidator.java | 2 +-
.../refresher/type/AlterTableStatementSchemaRefresher.java | 4 +---
.../refresher/type/AlterViewStatementSchemaRefresher.java | 4 +---
.../refresher/type/RenameTableStatementSchemaRefresher.java | 4 +---
.../result/query/impl/driver/jdbc/type/util/ResultSetUtil.java | 3 ++-
.../sql/prepare/driver/DriverExecutionPrepareEngine.java | 4 ++--
.../core/statement/ReadwriteSplittingPreparedStatementTest.java | 2 +-
.../data/pipeline/core/ingest/channel/memory/ManualBitSet.java | 4 ++--
.../job/progress/persist/PipelineJobProgressPersistService.java | 4 +---
.../data/pipeline/mysql/ingest/client/PasswordEncryption.java | 2 +-
.../shardingsphere/proxy/arguments/BootstrapArguments.java | 3 ++-
.../shardingsphere/proxy/arguments/BootstrapArgumentsTest.java | 9 +++++----
.../proxy/frontend/connection/ConnectionIdGenerator.java | 2 +-
.../frontend/postgresql/command/query/PostgreSQLCommand.java | 4 ++--
.../sql/parser/sql/common/extractor/TableExtractorTest.java | 4 ++--
.../mix/YamlShardingWithReadwriteSplittingIntegrateTest.java | 5 +----
17 files changed, 28 insertions(+), 35 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
index 2ca09f6642f..4892fde9585 100644
---
a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/test/java/org/apache/shardingsphere/db/protocol/mysql/packet/command/query/text/MySQLTextResultSetRowPacketTest.java
@@ -28,6 +28,7 @@ import java.sql.Timestamp;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
+import java.util.Collections;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
@@ -82,7 +83,7 @@ public final class MySQLTextResultSetRowPacketTest {
public void assertLocalDateTime() {
String localDateTimeStr = "2021-08-23T17:30:30";
LocalDateTime time = LocalDateTime.parse(localDateTimeStr,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"));
- MySQLTextResultSetRowPacket actual = new
MySQLTextResultSetRowPacket(1, Arrays.asList(time));
+ MySQLTextResultSetRowPacket actual = new
MySQLTextResultSetRowPacket(1, Collections.singletonList(time));
actual.write(payload);
verify(payload).writeStringLenenc(DateTimeFormatter.ofPattern("yyyy-MM-dd
HH:mm:ss").format(LocalDateTime.parse(localDateTimeStr,
DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss"))));
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
index 32117e4f489..1fd45d5af8f 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
@@ -49,7 +49,7 @@ public final class ShardingDropTableStatementValidator
extends ShardingDDLStatem
if
(!DropTableStatementHandler.ifExists(sqlStatementContext.getSqlStatement())) {
String defaultSchemaName =
DatabaseTypeEngine.getDefaultSchemaName(sqlStatementContext.getDatabaseType(),
database.getName());
ShardingSphereSchema schema =
sqlStatementContext.getTablesContext().getSchemaName()
- .map(optional ->
database.getSchema(optional)).orElseGet(() ->
database.getSchema(defaultSchemaName));
+ .map(database::getSchema).orElseGet(() ->
database.getSchema(defaultSchemaName));
validateTableExist(schema,
sqlStatementContext.getTablesContext().getTables());
}
if
(DropTableStatementHandler.containsCascade(sqlStatementContext.getSqlStatement()))
{
diff --git
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterTableStatementSchemaRefresher.java
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterTableStatementSchemaRefresher.java
index cd90a664e8f..7d98e379cbf 100644
---
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterTableStatementSchemaRefresher.java
+++
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterTableStatementSchemaRefresher.java
@@ -73,9 +73,7 @@ public final class AlterTableStatementSchemaRefresher
implements MetaDataRefresh
database.getResource().getDatabaseType(),
database.getResource().getDataSources(), database.getRuleMetaData().getRules(),
props, schemaName);
Map<String, ShardingSphereSchema> schemaMap =
GenericSchemaBuilder.build(Collections.singletonList(tableName), materials);
Optional<ShardingSphereTable> actualTableMetaData =
Optional.ofNullable(schemaMap.get(schemaName)).map(optional ->
optional.get(tableName));
- actualTableMetaData.ifPresent(optional -> {
- database.getSchema(schemaName).put(tableName, optional);
- });
+ actualTableMetaData.ifPresent(optional ->
database.getSchema(schemaName).put(tableName, optional));
}
private boolean containsInImmutableDataNodeContainedRule(final String
tableName, final ShardingSphereDatabase database) {
diff --git
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterViewStatementSchemaRefresher.java
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterViewStatementSchemaRefresher.java
index 096da253046..44da6b6d470 100644
---
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterViewStatementSchemaRefresher.java
+++
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/AlterViewStatementSchemaRefresher.java
@@ -76,9 +76,7 @@ public final class AlterViewStatementSchemaRefresher
implements MetaDataRefreshe
database.getResource().getDatabaseType(),
database.getResource().getDataSources(), database.getRuleMetaData().getRules(),
props, schemaName);
Map<String, ShardingSphereSchema> schemaMap =
GenericSchemaBuilder.build(Collections.singletonList(viewName), materials);
Optional<ShardingSphereTable> actualViewMetaData =
Optional.ofNullable(schemaMap.get(schemaName)).map(optional ->
optional.get(viewName));
- actualViewMetaData.ifPresent(optional -> {
- database.getSchema(schemaName).put(viewName, optional);
- });
+ actualViewMetaData.ifPresent(optional ->
database.getSchema(schemaName).put(viewName, optional));
}
private boolean containsInImmutableDataNodeContainedRule(final String
viewName, final ShardingSphereDatabase database) {
diff --git
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/RenameTableStatementSchemaRefresher.java
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/RenameTableStatementSchemaRefresher.java
index 7f1b374a361..3c33d26739c 100644
---
a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/RenameTableStatementSchemaRefresher.java
+++
b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/refresher/type/RenameTableStatementSchemaRefresher.java
@@ -71,9 +71,7 @@ public final class RenameTableStatementSchemaRefresher
implements MetaDataRefres
database.getResource().getDatabaseType(),
database.getResource().getDataSources(), database.getRuleMetaData().getRules(),
props, schemaName);
Map<String, ShardingSphereSchema> schemaMap =
GenericSchemaBuilder.build(Collections.singletonList(tableName), materials);
Optional<ShardingSphereTable> actualTableMetaData =
Optional.ofNullable(schemaMap.get(schemaName)).map(optional ->
optional.get(tableName));
- actualTableMetaData.ifPresent(optional -> {
- database.getSchema(schemaName).put(tableName, optional);
- });
+ actualTableMetaData.ifPresent(optional ->
database.getSchema(schemaName).put(tableName, optional));
}
private boolean containsInImmutableDataNodeContainedRule(final String
tableName, final ShardingSphereDatabase database) {
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtil.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtil.java
index 214298e4694..e983e0cb911 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtil.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/execute/result/query/impl/driver/jdbc/type/util/ResultSetUtil.java
@@ -25,6 +25,7 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.infra.exception.ShardingSphereException;
import java.math.BigDecimal;
+import java.math.RoundingMode;
import java.net.MalformedURLException;
import java.net.URL;
import java.sql.SQLException;
@@ -124,7 +125,7 @@ public final class ResultSetUtil {
try {
return value.setScale(scale);
} catch (final ArithmeticException ex) {
- return value.setScale(scale, BigDecimal.ROUND_HALF_UP);
+ return value.setScale(scale, RoundingMode.HALF_UP);
}
}
return value;
diff --git
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java
index 2f167ed91c7..e3a07595bed 100644
---
a/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java
+++
b/shardingsphere-infra/shardingsphere-infra-executor/src/main/java/org/apache/shardingsphere/infra/executor/sql/prepare/driver/DriverExecutionPrepareEngine.java
@@ -62,8 +62,8 @@ public final class DriverExecutionPrepareEngine<T extends
DriverExecutionUnit<?>
}
/**
- * Refer to https://bugs.openjdk.java.net/browse/JDK-8161372.
- *
+ * Refer to <a
href="https://bugs.openjdk.java.net/browse/JDK-8161372">JDK-8161372</a>.
+ *
* @param type type
* @return sql execution unit builder
*/
diff --git
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
index f94fafc88dd..d2ec7095d8f 100644
---
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
+++
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/statement/ReadwriteSplittingPreparedStatementTest.java
@@ -103,7 +103,7 @@ public final class ReadwriteSplittingPreparedStatementTest
extends AbstractShard
PreparedStatement preparedStatement =
connection.prepareStatement("INSERT INTO t_config(id, status) VALUES(?, ?);",
Statement.RETURN_GENERATED_KEYS)) {
connection.setAutoCommit(false);
Object lastGeneratedId = null;
- Object generatedId = null;
+ Object generatedId;
for (int i = 1; i <= 3; i++) {
preparedStatement.setObject(1, null);
preparedStatement.setString(2, "OK");
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
index 46a5e5bc696..1f09c6a5f5d 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/ingest/channel/memory/ManualBitSet.java
@@ -97,7 +97,7 @@ public final class ManualBitSet {
int begin = i == listIndex ? correctIndex % BIT_SET_SIZE : 0;
for (int j = begin; j < BIT_SET_SIZE; j++) {
if (bitSets.get(i).get(j) && --count == 0) {
- return startIndex + i * BIT_SET_SIZE + j + 1;
+ return startIndex + (long) i * BIT_SET_SIZE + j + 1;
}
}
}
@@ -115,7 +115,7 @@ public final class ManualBitSet {
int count = Math.min(bitSets.size(), (int) ((bitIndex -
startIndex) / BIT_SET_SIZE));
if (count > 0) {
bitSets.subList(0, count).clear();
- startIndex += count * BIT_SET_SIZE;
+ startIndex += (long) count * BIT_SET_SIZE;
}
}
}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/progress/persist/PipelineJobProgressPersistService.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/progress/persist/PipelineJobProgressPersistService.java
index 100a112bf93..cb7c66aa166 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/progress/persist/PipelineJobProgressPersistService.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/job/progress/persist/PipelineJobProgressPersistService.java
@@ -117,9 +117,7 @@ public final class PipelineJobProgressPersistService {
@Override
public void run() {
for (Entry<String, Map<Integer,
PipelineJobProgressPersistContext>> entry :
JOB_PROGRESS_PERSIST_MAP.entrySet()) {
- entry.getValue().forEach((shardingItem, persistContext) -> {
- persist(entry.getKey(), shardingItem, persistContext);
- });
+ entry.getValue().forEach((shardingItem, persistContext) ->
persist(entry.getKey(), shardingItem, persistContext));
}
}
}
diff --git
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
index 4f8122f1544..369df0d7743 100644
---
a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
+++
b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/PasswordEncryption.java
@@ -41,7 +41,7 @@ public final class PasswordEncryption {
*
* <p>
* MySQL Internals Manual / MySQL Client/Server Protocol /
Authentication Method / Secure Password Authentication
- *
https://dev.mysql.com/doc/internals/en/secure-password-authentication.html
+ * <a
href="https://dev.mysql.com/doc/internals/en/secure-password-authentication.html">secure-password-authentication</a>
* </p>
*
* @param password password
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
index c5adc625a15..2db76610d70 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.arguments;
import lombok.RequiredArgsConstructor;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
@@ -70,7 +71,7 @@ public final class BootstrapArguments {
* @return address list
*/
public List<String> getAddresses() {
- return args.length < 3 ? Arrays.asList(DEFAULT_BIND_ADDRESS) :
Arrays.asList(args[2].split(","));
+ return args.length < 3 ?
Collections.singletonList(DEFAULT_BIND_ADDRESS) :
Arrays.asList(args[2].split(","));
}
private String paddingWithSlash(final String pathArg) {
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/arguments/BootstrapArgumentsTest.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/arguments/BootstrapArgumentsTest.java
index 50e1fa235e8..3eed456f314 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/arguments/BootstrapArgumentsTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/arguments/BootstrapArgumentsTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.arguments;
import org.junit.Test;
import java.util.Arrays;
+import java.util.Collections;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
@@ -85,22 +86,22 @@ public final class BootstrapArgumentsTest {
@Test
public void assertGetAddressesWithEmptyArgument() {
- assertThat(new BootstrapArguments(new String[]{}).getAddresses(),
is(Arrays.asList("0.0.0.0")));
+ assertThat(new BootstrapArguments(new String[]{}).getAddresses(),
is(Collections.singletonList("0.0.0.0")));
}
@Test
public void assertGetAddressesWithSingleArgument() {
- assertThat(new BootstrapArguments(new
String[]{"3306"}).getAddresses(), is(Arrays.asList("0.0.0.0")));
+ assertThat(new BootstrapArguments(new
String[]{"3306"}).getAddresses(), is(Collections.singletonList("0.0.0.0")));
}
@Test
public void assertGetAddressesWithTwoArgument() {
- assertThat(new BootstrapArguments(new String[]{"3306",
"test_conf"}).getAddresses(), is(Arrays.asList("0.0.0.0")));
+ assertThat(new BootstrapArguments(new String[]{"3306",
"test_conf"}).getAddresses(), is(Collections.singletonList("0.0.0.0")));
}
@Test
public void assertGetAddressesWithThreeArguments() {
- assertThat(new BootstrapArguments(new String[]{"3306", "test_conf",
"127.0.0.1"}).getAddresses(), is(Arrays.asList("127.0.0.1")));
+ assertThat(new BootstrapArguments(new String[]{"3306", "test_conf",
"127.0.0.1"}).getAddresses(), is(Collections.singletonList("127.0.0.1")));
assertThat(new BootstrapArguments(new String[]{"3306", "test_conf",
"1.1.1.1,127.0.0.1"}).getAddresses(), is(Arrays.asList("1.1.1.1",
"127.0.0.1")));
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/connection/ConnectionIdGenerator.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/connection/ConnectionIdGenerator.java
index c142bd53ec1..388f30e66f9 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/connection/ConnectionIdGenerator.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/connection/ConnectionIdGenerator.java
@@ -45,7 +45,7 @@ public final class ConnectionIdGenerator {
* @return next connection ID
*/
public synchronized int nextId() {
- if (currentId >= Integer.MAX_VALUE) {
+ if (currentId == Integer.MAX_VALUE) {
currentId = 0;
}
return ++currentId;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
index 00367b4a81e..20462545eab 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-postgresql/src/main/java/org/apache/shardingsphere/proxy/frontend/postgresql/command/query/PostgreSQLCommand.java
@@ -154,8 +154,8 @@ public enum PostgreSQLCommand {
}
/**
- * Refer to https://bugs.openjdk.java.net/browse/JDK-8161372.
- *
+ * Refer to <a
href="https://bugs.openjdk.java.net/browse/JDK-8161372">JDK-8161372</a>.
+ *
* @param sqlStatementClass sql statement class
* @return optional PostgreSQLCommand
*/
diff --git
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractorTest.java
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractorTest.java
index 74ffe7a0e01..8ffcf7db7e8 100644
---
a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractorTest.java
+++
b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractorTest.java
@@ -35,8 +35,8 @@ import
org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQ
import org.junit.Test;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
+import java.util.Collections;
import java.util.Iterator;
import java.util.Optional;
@@ -85,7 +85,7 @@ public final class TableExtractorTest {
Collection<AssignmentSegment> assignmentSegments = new ArrayList<>();
ColumnSegment columnSegment = new ColumnSegment(133, 136, new
IdentifierValue("id"));
columnSegment.setOwner(new OwnerSegment(130, 132, new
IdentifierValue("t_order")));
- assignmentSegments.add(new ColumnAssignmentSegment(130, 140,
Arrays.asList(columnSegment), new LiteralExpressionSegment(141, 142, 1)));
+ assignmentSegments.add(new ColumnAssignmentSegment(130, 140,
Collections.singletonList(columnSegment), new LiteralExpressionSegment(141,
142, 1)));
mySQLInsertStatement.setOnDuplicateKeyColumns(new
OnDuplicateKeyColumnsSegment(130, 140, assignmentSegments));
tableExtractor.extractTablesFromInsert(mySQLInsertStatement);
assertThat(tableExtractor.getRewriteTables().size(), is(2));
diff --git
a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
index c5cb85be373..c811fb2c53f 100644
---
a/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
+++
b/shardingsphere-test/shardingsphere-integration-driver-test/src/test/java/org/apache/shardingsphere/driver/mix/YamlShardingWithReadwriteSplittingIntegrateTest.java
@@ -34,7 +34,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Objects;
@RunWith(Parameterized.class)
@@ -68,9 +67,7 @@ public final class
YamlShardingWithReadwriteSplittingIntegrateTest extends Abstr
dataSourceMap.put("write_ds_1", createDataSource("write_ds_1"));
dataSourceMap.put("read_ds_1", createDataSource("read_ds_1"));
Map<String, DataSource> result = new
HashMap<>(dataSourceMap.size(), 1);
- for (Entry<String, DataSource> each : dataSourceMap.entrySet()) {
- result.put(each.getKey(), each.getValue());
- }
+ result.putAll(dataSourceMap);
dataSource =
YamlShardingSphereDataSourceFactory.createDataSource(result, yamlFile);
}
try (