This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 2a2100fdc9b Refactor rule on CatchParameterName for checkstyle (#30893)
2a2100fdc9b is described below
commit 2a2100fdc9bbdd2fd3725cac18ec307bdfb9264e
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Apr 15 13:47:46 2024 +0800
Refactor rule on CatchParameterName for checkstyle (#30893)
---
.../main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java | 2 +-
.../sql/parser/core/database/parser/SQLParserExecutor.java | 4 ++--
.../shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java | 4 ++--
src/resources/checkstyle.xml | 4 +++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git
a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
index 5d6170ed3e9..fe1b4d3246c 100644
---
a/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
+++
b/infra/common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
@@ -131,7 +131,7 @@ public final class SQLHintUtils {
private static Object convert(final String value) {
try {
return new BigInteger(value);
- } catch (final NumberFormatException e) {
+ } catch (final NumberFormatException ignored) {
return value;
}
}
diff --git
a/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
b/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
index 5a641f247f4..672641fa960 100644
---
a/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
+++
b/parser/sql/engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
@@ -66,8 +66,8 @@ public final class SQLParserExecutor {
((Parser)
sqlParser).addErrorListener(SQLParserErrorListener.getInstance());
try {
return (ParseASTNode) sqlParser.parse();
- } catch (final ParseCancellationException e) {
- throw new SQLParsingException(sql + ", " + e.getMessage());
+ } catch (final ParseCancellationException exception) {
+ throw new SQLParsingException(sql + ", " +
exception.getMessage());
}
}
}
diff --git
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java
index 199ab0e4e4e..f4e7beab425 100644
---
a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java
+++
b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/connector/DatabaseConnectorTest.java
@@ -165,8 +165,8 @@ class DatabaseConnectorTest {
Exception ex = null;
try {
engine.getRowData();
- } catch (final SQLException | IndexOutOfBoundsException e) {
- ex = e;
+ } catch (final SQLException | IndexOutOfBoundsException exception)
{
+ ex = exception;
} finally {
assertFalse(ex instanceof IndexOutOfBoundsException);
}
diff --git a/src/resources/checkstyle.xml b/src/resources/checkstyle.xml
index 0cc2348d645..1420466303c 100644
--- a/src/resources/checkstyle.xml
+++ b/src/resources/checkstyle.xml
@@ -232,7 +232,9 @@
<module name="AbbreviationAsWordInName">
<property name="allowedAbbreviationLength" value="8" />
</module>
- <module name="CatchParameterName" />
+ <module name="CatchParameterName">
+ <property name="format" value="^(ex|[a-z][a-z][a-zA-Z]+)$"/>
+ </module>
<module name="ClassTypeParameterName" />
<module name="ConstantName" />
<module name="InterfaceTypeParameterName" />