This is an automated email from the ASF dual-hosted git repository.
sunnianjun 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 7f291eca78d Fix sonar issues (#30065)
7f291eca78d is described below
commit 7f291eca78d9aff08783ae7b97a5a5b49536cfd5
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Feb 8 11:12:38 2024 +0800
Fix sonar issues (#30065)
---
.../bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java | 8 ++++----
.../shardingsphere/transaction/xa/spi/SingleXAResource.java | 2 +-
.../mode/manager/context/ConfigurationContextManager.java | 2 +-
.../repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
index d372343d223..d905f0912db 100644
---
a/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
+++
b/db-protocol/postgresql/src/test/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/PostgreSQLUUIDBinaryProtocolValueTest.java
@@ -38,14 +38,14 @@ class PostgreSQLUUIDBinaryProtocolValueTest {
@Test
void assertRead() {
- UUID randomUUID = UUID.randomUUID();
+ UUID uuid = UUID.fromString("00000000-000-0000-0000-000000000001");
byte[] expected = new byte[16];
ByteBuffer buffer = ByteBuffer.wrap(expected);
- buffer.putLong(randomUUID.getMostSignificantBits());
- buffer.putLong(randomUUID.getLeastSignificantBits());
+ buffer.putLong(uuid.getMostSignificantBits());
+ buffer.putLong(uuid.getLeastSignificantBits());
ByteBuf byteBuf = Unpooled.wrappedBuffer(expected);
PostgreSQLPacketPayload payload = new PostgreSQLPacketPayload(byteBuf,
StandardCharsets.UTF_8);
- assertThat(new PostgreSQLUUIDBinaryProtocolValue().read(payload, 16),
is(randomUUID));
+ assertThat(new PostgreSQLUUIDBinaryProtocolValue().read(payload, 16),
is(uuid));
}
@Test
diff --git
a/kernel/transaction/type/xa/spi/src/main/java/org/apache/shardingsphere/transaction/xa/spi/SingleXAResource.java
b/kernel/transaction/type/xa/spi/src/main/java/org/apache/shardingsphere/transaction/xa/spi/SingleXAResource.java
index 4375cbcf057..5ef327683be 100644
---
a/kernel/transaction/type/xa/spi/src/main/java/org/apache/shardingsphere/transaction/xa/spi/SingleXAResource.java
+++
b/kernel/transaction/type/xa/spi/src/main/java/org/apache/shardingsphere/transaction/xa/spi/SingleXAResource.java
@@ -114,7 +114,7 @@ public final class SingleXAResource implements XAResource {
}
}
- private XAException mapXAException(final XAException exception) throws
XAException {
+ private XAException mapXAException(final XAException exception) {
return exception;
}
}
diff --git
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
index dd124c44a4d..31544fa19a6 100644
---
a/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
+++
b/mode/core/src/main/java/org/apache/shardingsphere/mode/manager/context/ConfigurationContextManager.java
@@ -153,7 +153,7 @@ public final class ConfigurationContextManager {
try {
Collection<ResourceHeldRule> staleResourceHeldRules =
getStaleResourceHeldRules(databaseName);
// TODO consider rename this method to
alterDatabaseRuleConfiguration
- staleResourceHeldRules.stream().filter(each -> each instanceof
DatabaseRule).forEach(ResourceHeldRule::closeStaleResource);
+
staleResourceHeldRules.stream().filter(DatabaseRule.class::isInstance).forEach(ResourceHeldRule::closeStaleResource);
MetaDataContexts reloadMetaDataContexts =
createMetaDataContextsWhenRuleChanged(databaseName, false, null, ruleConfigs);
alterSchemaMetaData(databaseName,
reloadMetaDataContexts.getMetaData().getDatabase(databaseName),
metaDataContexts.get().getMetaData().getDatabase(databaseName));
metaDataContexts.set(reloadMetaDataContexts);
diff --git
a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
index 732f2037551..94f691d680c 100644
---
a/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
+++
b/mode/type/standalone/repository/provider/jdbc/src/main/java/org/apache/shardingsphere/mode/repository/standalone/jdbc/sql/JDBCRepositorySQLLoader.java
@@ -172,7 +172,6 @@ public final class JDBCRepositorySQLLoader {
}
private static JDBCRepositorySQL loadFromJar(final URL url, final String
type) throws IOException {
- JDBCRepositorySQL result = null;
URL jarUrl = url;
if ("zip".equals(url.getProtocol())) {
jarUrl = new URL(url.toExternalForm().replace("zip:/",
"jar:file:/"));
@@ -181,6 +180,7 @@ public final class JDBCRepositorySQLLoader {
if (!(urlConnection instanceof JarURLConnection)) {
return null;
}
+ JDBCRepositorySQL result = null;
try (JarFile jar = ((JarURLConnection) urlConnection).getJarFile()) {
Enumeration<JarEntry> entries = jar.entries();
while (entries.hasMoreElements()) {