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 8e4e2daeb9d Refactor MySQLStatusFlag (#21248)
8e4e2daeb9d is described below
commit 8e4e2daeb9d67c25efcf2a010e47ebb3e8af064d
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Sep 28 20:45:24 2022 +0800
Refactor MySQLStatusFlag (#21248)
---
.../shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java | 5 ++++-
.../db/protocol/mysql/constant/MySQLStatusFlagTest.java | 3 ++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git
a/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
b/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
index 38e149a7bf4..796f86f910a 100644
---
a/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
+++
b/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlag.java
@@ -19,6 +19,9 @@ package org.apache.shardingsphere.db.protocol.mysql.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
+import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnknownSQLException;
+
+import java.sql.SQLException;
/**
* Status flags are a bit-field for MySQL.
@@ -71,6 +74,6 @@ public enum MySQLStatusFlag {
return each;
}
}
- throw new IllegalArgumentException(String.format("Illegal MySQL status
flag value %d", value));
+ throw new UnknownSQLException(new SQLException(String.format("Illegal
MySQL status flag value %d", value)));
}
}
diff --git
a/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
b/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
index 6c1a687df86..b0a096a32e8 100644
---
a/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
+++
b/shardingsphere-db-protocol/shardingsphere-mysql-protocol/src/test/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLStatusFlagTest.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.db.protocol.mysql.constant;
+import
org.apache.shardingsphere.infra.util.exception.external.sql.type.generic.UnknownSQLException;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
@@ -34,7 +35,7 @@ public final class MySQLStatusFlagTest {
assertThat(MySQLStatusFlag.valueOf(0x0001),
is(MySQLStatusFlag.SERVER_STATUS_IN_TRANS));
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = UnknownSQLException.class)
public void assertValueOfByIntegerFailure() {
MySQLStatusFlag.valueOf(0x0011);
}