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 56eb87425d7 Refactor ShardingSphereSQLException (#20163)
56eb87425d7 is described below
commit 56eb87425d75dd90dd1e088910111dc1d634ebbd
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Aug 14 15:02:07 2022 +0800
Refactor ShardingSphereSQLException (#20163)
* Refactor ShardingSphereSQLException
* For checkstyle
* For checkstyle
---
.../exception/dialect/SQLDialectException.java | 4 ++--
.../exception/standard/SQLStandardException.java | 28 ----------------------
.../{ => standard}/ShardingSphereSQLException.java | 4 ++--
.../command/UnsupportedCommandException.java | 4 ++--
.../standard/connection/CircuitBreakException.java | 4 ++--
.../lock/TableLockWaitTimeoutException.java | 4 ++--
.../standard/lock/TableLockedException.java | 4 ++--
.../standard/rule/ResourceNotExistedException.java | 4 ++--
.../standard/rule/RuleNotExistedException.java | 4 ++--
.../shadow/validator/ShadowValueValidator.java | 4 ++--
10 files changed, 18 insertions(+), 46 deletions(-)
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/dialect/SQLDialectException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/dialect/SQLDialectException.java
index 996322a6b2a..8160aed94f7 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/dialect/SQLDialectException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/dialect/SQLDialectException.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.error.exception.dialect;
-import org.apache.shardingsphere.error.exception.ShardingSphereSQLException;
+import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
/**
* SQL dialect exception.
*/
-public abstract class SQLDialectException extends ShardingSphereSQLException {
+public abstract class SQLDialectException extends
ShardingSphereInsideException {
private static final long serialVersionUID = -5090068160364259336L;
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/SQLStandardException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/SQLStandardException.java
deleted file mode 100644
index 2a6f1157696..00000000000
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/SQLStandardException.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.error.exception.standard;
-
-import org.apache.shardingsphere.error.exception.ShardingSphereSQLException;
-
-/**
- * SQL standard exception.
- */
-public abstract class SQLStandardException extends ShardingSphereSQLException {
-
- private static final long serialVersionUID = -8238061892944243621L;
-}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/ShardingSphereSQLException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/ShardingSphereSQLException.java
similarity index 88%
rename from
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/ShardingSphereSQLException.java
rename to
shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/ShardingSphereSQLException.java
index 020f93913d2..d9c895f1bc0 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/ShardingSphereSQLException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/ShardingSphereSQLException.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.error.exception;
+package org.apache.shardingsphere.error.exception.standard;
import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideException;
@@ -24,5 +24,5 @@ import
org.apache.shardingsphere.infra.util.exception.ShardingSphereInsideExcept
*/
public abstract class ShardingSphereSQLException extends
ShardingSphereInsideException {
- private static final long serialVersionUID = 533138919589855426L;
+ private static final long serialVersionUID = -8238061892944243621L;
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/command/UnsupportedCommandException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/command/UnsupportedCommandException.java
index bb86f0f1b51..84773f64231 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/command/UnsupportedCommandException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/command/UnsupportedCommandException.java
@@ -19,14 +19,14 @@ package
org.apache.shardingsphere.error.exception.standard.command;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Unsupported command exception.
*/
@RequiredArgsConstructor
@Getter
-public final class UnsupportedCommandException extends SQLStandardException {
+public final class UnsupportedCommandException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 8010680371699936338L;
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/connection/CircuitBreakException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/connection/CircuitBreakException.java
index b05071d74c6..5d7f2d8ae43 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/connection/CircuitBreakException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/connection/CircuitBreakException.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.error.exception.standard.connection;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Circuit break exception.
*/
-public final class CircuitBreakException extends SQLStandardException {
+public final class CircuitBreakException extends ShardingSphereSQLException {
private static final long serialVersionUID = 6339672680026286798L;
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockWaitTimeoutException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockWaitTimeoutException.java
index 80cc638bce5..43b9a0d1f3c 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockWaitTimeoutException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockWaitTimeoutException.java
@@ -19,14 +19,14 @@ package
org.apache.shardingsphere.error.exception.standard.lock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Table lock wait timeout exception.
*/
@RequiredArgsConstructor
@Getter
-public final class TableLockWaitTimeoutException extends SQLStandardException {
+public final class TableLockWaitTimeoutException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 2599713085782288003L;
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockedException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockedException.java
index 8833db0d460..301ad918246 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockedException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/lock/TableLockedException.java
@@ -19,14 +19,14 @@ package
org.apache.shardingsphere.error.exception.standard.lock;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Table locked exception.
*/
@RequiredArgsConstructor
@Getter
-public final class TableLockedException extends SQLStandardException {
+public final class TableLockedException extends ShardingSphereSQLException {
private static final long serialVersionUID = 2622020743612706932L;
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/ResourceNotExistedException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/ResourceNotExistedException.java
index ae9c384a12a..3b6f03f2731 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/ResourceNotExistedException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/ResourceNotExistedException.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.error.exception.standard.rule;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Resource does not exist exception.
*/
-public final class ResourceNotExistedException extends SQLStandardException {
+public final class ResourceNotExistedException extends
ShardingSphereSQLException {
private static final long serialVersionUID = 4146100333670404924L;
}
diff --git
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/RuleNotExistedException.java
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/RuleNotExistedException.java
index 092b39254e9..f5bf441607b 100644
---
a/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/RuleNotExistedException.java
+++
b/shardingsphere-error/shardingsphere-common-error/src/main/java/org/apache/shardingsphere/error/exception/standard/rule/RuleNotExistedException.java
@@ -17,12 +17,12 @@
package org.apache.shardingsphere.error.exception.standard.rule;
-import org.apache.shardingsphere.error.exception.standard.SQLStandardException;
+import
org.apache.shardingsphere.error.exception.standard.ShardingSphereSQLException;
/**
* Rule does not exist exception.
*/
-public final class RuleNotExistedException extends SQLStandardException {
+public final class RuleNotExistedException extends ShardingSphereSQLException {
private static final long serialVersionUID = -4150905802300104824L;
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
index a59cb3a82c0..c34ba64937e 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/validator/ShadowValueValidator.java
@@ -31,7 +31,7 @@ import java.util.Set;
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class ShadowValueValidator {
- private final static Set<Class<?>> UNSUPPORTED_TYPES = new HashSet<>();
+ private static final Set<Class<?>> UNSUPPORTED_TYPES = new HashSet<>();
static {
UNSUPPORTED_TYPES.add(Date.class);
@@ -45,7 +45,7 @@ public final class ShadowValueValidator {
* @param column column name
* @param shadowValue shadow value
*/
- public static void validate(String table, String column, Comparable<?>
shadowValue) {
+ public static void validate(final String table, final String column, final
Comparable<?> shadowValue) {
for (Class<?> each : UNSUPPORTED_TYPES) {
if (each.isAssignableFrom(shadowValue.getClass())) {
throw new ShadowAlgorithmException("Shadow column `%s` of
table `%s` does not support `%s` type", column, table, each);