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 16e2b7a454a Add final declaration on exception catch statements
(#28272)
16e2b7a454a is described below
commit 16e2b7a454ac6a2648a68bc0fb86bb249b818c3d
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 27 16:24:03 2023 +0800
Add final declaration on exception catch statements (#28272)
---
.../bind/protocol/text/impl/PostgreSQLBitValueParser.java | 2 +-
.../example/proxy/distsql/DistSQLFeatureExample.java | 8 +++++---
.../shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java | 4 ++--
.../shardingsphere/infra/util/reflection/ReflectionUtils.java | 2 +-
.../proxy/backend/hbase/context/HBaseRegionWarmUpContext.java | 6 +++---
.../apache/shardingsphere/proxy/arguments/BootstrapArguments.java | 2 +-
.../frontend/mysql/authentication/MySQLAuthenticationEngine.java | 2 +-
.../test/it/optimizer/converter/SQLNodeConverterEngineIT.java | 2 +-
8 files changed, 15 insertions(+), 13 deletions(-)
diff --git
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLBitValueParser.java
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLBitValueParser.java
index 9db7afc6c8c..b60d225b79b 100644
---
a/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLBitValueParser.java
+++
b/db-protocol/postgresql/src/main/java/org/apache/shardingsphere/db/protocol/postgresql/packet/command/query/extended/bind/protocol/text/impl/PostgreSQLBitValueParser.java
@@ -35,7 +35,7 @@ public final class PostgreSQLBitValueParser implements
PostgreSQLTextValueParser
result.setType("bit");
result.setValue(value);
return result;
- } catch (SQLException ex) {
+ } catch (final SQLException ex) {
throw new SQLWrapperException(ex);
}
}
diff --git
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/DistSQLFeatureExample.java
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/DistSQLFeatureExample.java
index 55688a8b48a..ceaed8d86ae 100644
---
a/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/DistSQLFeatureExample.java
+++
b/examples/shardingsphere-proxy-example/shardingsphere-proxy-distsql-example/src/main/java/org/apache/shardingsphere/example/proxy/distsql/DistSQLFeatureExample.java
@@ -42,12 +42,14 @@ public final class DistSQLFeatureExample {
DistSQLExecutor featureExecutor = selectFeature().getExecutor();
featureExecutor.init(statement);
featureExecutor.execute();
- } catch (Exception e) {
- log.error(e.getMessage());
+ // CHECKSTYLE:OFF
+ } catch (final Exception ex) {
+ // CHECKSTYLE:ON
+ log.error(ex.getMessage());
}
}
- private static FeatureType selectFeature(){
+ private static FeatureType selectFeature() {
// return FeatureType.RESOURCE;
// return FeatureType.SHADOW;
// return FeatureType.ENCRYPT;
diff --git
a/features/encrypt/plugin/sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
b/features/encrypt/plugin/sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
index 6653d76c6fe..61035f1c7dd 100644
---
a/features/encrypt/plugin/sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
+++
b/features/encrypt/plugin/sm/src/main/java/org/apache/shardingsphere/encrypt/sm/algorithm/SM4EncryptAlgorithm.java
@@ -150,8 +150,8 @@ public final class SM4EncryptAlgorithm implements
StandardEncryptAlgorithm<Objec
static byte[] fromHexString(final String s) {
try {
return Hex.decodeHex(s);
- } catch (DecoderException e) {
- throw new EncryptAlgorithmInitializationException("SM",
e.getMessage());
+ } catch (final DecoderException ex) {
+ throw new EncryptAlgorithmInitializationException("SM",
ex.getMessage());
}
}
}
diff --git
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/reflection/ReflectionUtils.java
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/reflection/ReflectionUtils.java
index 85c91fdf01c..c99d85ede5c 100644
---
a/infra/util/src/main/java/org/apache/shardingsphere/infra/util/reflection/ReflectionUtils.java
+++
b/infra/util/src/main/java/org/apache/shardingsphere/infra/util/reflection/ReflectionUtils.java
@@ -160,7 +160,7 @@ public final class ReflectionUtils {
private static Optional<Method> findMethod(final Class<?> clazz, final
String methodName, final Class<?>... parameterTypes) {
try {
return Optional.of(clazz.getMethod(methodName, parameterTypes));
- } catch (NoSuchMethodException e) {
+ } catch (final NoSuchMethodException ex) {
Class<?> superclass = clazz.getSuperclass();
if (null != superclass && Object.class != superclass) {
return findMethod(superclass, methodName, parameterTypes);
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 bc5afda592b..39e4a70674b 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
@@ -84,13 +84,13 @@ public final class HBaseRegionWarmUpContext {
public void loadRegionInfo(final String tableName, final Connection
connection) {
HBaseRegionWarmUpContext.getInstance().addExecuteCount();
try {
- if (connection == null) {
+ if (null == connection) {
return;
}
RegionLocator regionLocator =
connection.getRegionLocator(TableName.valueOf(tableName));
regionLocator.getAllRegionLocations();
- } catch (IOException e) {
- throw new HBaseOperationException(String.format("table: %s warm up
error, getRegionLocator execute error reason is %s", tableName, e));
+ } catch (final IOException ex) {
+ throw new HBaseOperationException(String.format("table: %s warm up
error, getRegionLocator execute error reason is %s", tableName, ex));
}
}
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 bf1d5c43960..3a002fd1276 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
@@ -125,7 +125,7 @@ public final class BootstrapArguments {
private boolean isValidPath(final String path) {
try {
Paths.get(path);
- } catch (InvalidPathException ignored) {
+ } catch (final InvalidPathException ignored) {
throw new IllegalArgumentException(String.format("Invalid path
`%s`.", path));
}
return true;
diff --git
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
index 36ac10763c7..c62e37daaa2 100644
---
a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
+++
b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/authentication/MySQLAuthenticationEngine.java
@@ -113,7 +113,7 @@ public final class MySQLAuthenticationEngine implements
AuthenticationEngine {
MySQLHandshakeResponse41Packet handshakeResponsePacket;
try {
handshakeResponsePacket = new
MySQLHandshakeResponse41Packet((MySQLPacketPayload) payload);
- } catch (IndexOutOfBoundsException ex) {
+ } catch (final IndexOutOfBoundsException ex) {
if (log.isWarnEnabled()) {
log.warn("Received bad handshake from client {}: \n{}",
context.channel(),
ByteBufUtil.prettyHexDump(payload.getByteBuf().resetReaderIndex()));
}
diff --git
a/test/it/optimizer/src/test/java/org/apache/shardingsphere/test/it/optimizer/converter/SQLNodeConverterEngineIT.java
b/test/it/optimizer/src/test/java/org/apache/shardingsphere/test/it/optimizer/converter/SQLNodeConverterEngineIT.java
index 3f624e20616..0211da24818 100644
---
a/test/it/optimizer/src/test/java/org/apache/shardingsphere/test/it/optimizer/converter/SQLNodeConverterEngineIT.java
+++
b/test/it/optimizer/src/test/java/org/apache/shardingsphere/test/it/optimizer/converter/SQLNodeConverterEngineIT.java
@@ -70,7 +70,7 @@ class SQLNodeConverterEngineIT {
String expected;
try {
expected = SQL_NODE_CONVERTER_TEST_CASES.get(sqlCaseId,
sqlCaseType, databaseType).getExpectedSQL();
- } catch (IllegalStateException ex) {
+ } catch (final IllegalStateException ex) {
log.warn(ex.getMessage());
return;
}