This is an automated email from the ASF dual-hosted git repository.
menghaoran 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 774518c2d43 Rename CommonDistSQLException to DistSQLException (#20134)
774518c2d43 is described below
commit 774518c2d43f5c8f5c8e9093606664c45cbc67b6
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Aug 13 10:30:11 2022 +0800
Rename CommonDistSQLException to DistSQLException (#20134)
---
.../distsql/ral/common/exception/DistSQLErrorCode.java | 14 +++++++-------
.../{CommonDistSQLException.java => DistSQLException.java} | 4 ++--
.../ral/common/exception/InvalidValueException.java | 2 +-
.../ral/common/exception/UnsupportedVariableException.java | 2 +-
.../backend/handler/ProxyBackendHandlerFactoryTest.java | 2 +-
.../proxy/frontend/exception/ExpectedExceptions.java | 4 ++--
.../proxy/frontend/exception/ExpectedExceptionsTest.java | 4 ++--
.../proxy/frontend/mysql/err/MySQLErrPacketFactory.java | 8 ++++----
8 files changed, 20 insertions(+), 20 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
index 302018012fb..a0e9943d1be 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLErrorCode.java
@@ -39,18 +39,18 @@ public enum DistSQLErrorCode implements SQLErrorCode {
private final String errorMessage;
/**
- * Value of Dist SQL error code.
+ * Value of dist SQL error code.
*
- * @param exception exception
- * @return Dist SQL error code
+ * @param distSQLException dist SQL exception
+ * @return dist SQL error code
*/
- public static DistSQLErrorCode valueOf(final CommonDistSQLException
exception) {
- if (exception instanceof UnsupportedVariableException) {
+ public static DistSQLErrorCode valueOf(final DistSQLException
distSQLException) {
+ if (distSQLException instanceof UnsupportedVariableException) {
return UNSUPPORTED_VARIABLE;
}
- if (exception instanceof InvalidValueException) {
+ if (distSQLException instanceof InvalidValueException) {
return INVALID_VALUE;
}
- throw new UnsupportedOperationException("Can not find Dist SQL error
code from exception: %s", exception);
+ throw new UnsupportedOperationException("Can not find DistSQL error
code from exception: %s", distSQLException);
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLException.java
similarity index 92%
rename from
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLException.java
rename to
shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLException.java
index bd9cdf45a7d..f21fb4748ac 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/CommonDistSQLException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/DistSQLException.java
@@ -21,11 +21,11 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
- * Common dist sql exception.
+ * Dist SQL exception.
*/
@RequiredArgsConstructor
@Getter
-public class CommonDistSQLException extends RuntimeException {
+public class DistSQLException extends RuntimeException {
private static final long serialVersionUID = 4207057904023183986L;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/InvalidValueException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/InvalidValueException.java
index 71e5d4a2301..7aa0ccc05c6 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/InvalidValueException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/InvalidValueException.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.excep
/**
* Invalid value exception.
*/
-public final class InvalidValueException extends CommonDistSQLException {
+public final class InvalidValueException extends DistSQLException {
private static final long serialVersionUID = 1840341880422454371L;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/UnsupportedVariableException.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/UnsupportedVariableException.java
index 898effa9c9c..cfb0b20f80b 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/UnsupportedVariableException.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/exception/UnsupportedVariableException.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.excep
/**
* Unsupported variable exception.
*/
-public final class UnsupportedVariableException extends CommonDistSQLException
{
+public final class UnsupportedVariableException extends DistSQLException {
private static final long serialVersionUID = 1955281568807066737L;
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
index aa67ae3f66c..7e6549b6e79 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/ProxyBackendHandlerFactoryTest.java
@@ -111,7 +111,7 @@ public final class ProxyBackendHandlerFactoryTest extends
ProxyContextRestorer {
}
@Test
- public void assertNewInstanceWithCommonDistSQL() throws SQLException {
+ public void assertNewInstanceWithDistSQL() throws SQLException {
String sql = "set variable transaction_type='LOCAL'";
ProxyBackendHandler actual =
ProxyBackendHandlerFactory.newInstance(databaseType, sql, connectionSession);
assertThat(actual, instanceOf(SetVariableHandler.class));
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptions.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptions.java
index 5c6758b726e..8c0808bc5c8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptions.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptions.java
@@ -22,7 +22,7 @@ import lombok.NoArgsConstructor;
import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
import org.apache.shardingsphere.infra.exception.ShardingSphereException;
import
org.apache.shardingsphere.infra.util.exception.inside.ShardingSphereInsideException;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLException;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.DistSQLException;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import java.util.Collection;
@@ -41,7 +41,7 @@ public final class ExpectedExceptions {
EXCEPTIONS.add(ShardingSphereInsideException.class);
EXCEPTIONS.add(ShardingSphereConfigurationException.class);
EXCEPTIONS.add(SQLParsingException.class);
- EXCEPTIONS.add(CommonDistSQLException.class);
+ EXCEPTIONS.add(DistSQLException.class);
EXCEPTIONS.add(UnsupportedPreparedStatementException.class);
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptionsTest.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptionsTest.java
index baa8b80963d..07f642d65f8 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptionsTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/exception/ExpectedExceptionsTest.java
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurat
import org.apache.shardingsphere.infra.exception.ShardingSphereException;
import
org.apache.shardingsphere.infra.util.exception.inside.ShardingSphereInsideException;
import
org.apache.shardingsphere.infra.exception.dialect.NoDatabaseSelectedException;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLException;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.DistSQLException;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
import org.junit.Test;
@@ -36,7 +36,7 @@ public final class ExpectedExceptionsTest {
assertTrue(ExpectedExceptions.isExpected(ShardingSphereInsideException.class));
assertTrue(ExpectedExceptions.isExpected(ShardingSphereConfigurationException.class));
assertTrue(ExpectedExceptions.isExpected(SQLParsingException.class));
-
assertTrue(ExpectedExceptions.isExpected(CommonDistSQLException.class));
+ assertTrue(ExpectedExceptions.isExpected(DistSQLException.class));
assertTrue(ExpectedExceptions.isExpected(NoDatabaseSelectedException.class));
assertTrue(ExpectedExceptions.isExpected(UnsupportedPreparedStatementException.class));
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
index c76af9a8154..bff403f5383 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.error.code.StandardSQLErrorCode;
import org.apache.shardingsphere.error.mysql.code.MySQLServerErrorCode;
import
org.apache.shardingsphere.infra.util.exception.inside.ShardingSphereInsideException;
import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.DistSQLErrorCode;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.CommonDistSQLException;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.common.exception.DistSQLException;
import
org.apache.shardingsphere.proxy.frontend.exception.FrontendTooManyConnectionsException;
import
org.apache.shardingsphere.proxy.frontend.exception.UnsupportedPreparedStatementException;
@@ -56,9 +56,9 @@ public final class MySQLErrPacketFactory {
SQLException sqlException = SQLExceptionHandler.convert("MySQL",
(ShardingSphereInsideException) cause);
return new MySQLErrPacket(1, sqlException.getErrorCode(),
sqlException.getSQLState(), sqlException.getMessage());
}
- if (cause instanceof CommonDistSQLException) {
- CommonDistSQLException commonDistSQLException =
(CommonDistSQLException) cause;
- return new MySQLErrPacket(1,
DistSQLErrorCode.valueOf(commonDistSQLException),
commonDistSQLException.getVariable());
+ if (cause instanceof DistSQLException) {
+ DistSQLException distSQLException = (DistSQLException) cause;
+ return new MySQLErrPacket(1,
DistSQLErrorCode.valueOf(distSQLException), distSQLException.getVariable());
}
if (cause instanceof UnsupportedPreparedStatementException) {
return new MySQLErrPacket(1,
MySQLServerErrorCode.ER_UNSUPPORTED_PS);