You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/08/29 09:53:16 UTC
(shardingsphere) branch master updated: Consolidate database protocol exceptions (#39634)
This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 61053dd7393 Consolidate database protocol exceptions (#39634)
61053dd7393 is described below
commit 61053dd7393ccd76f8b1bdcaf6a6356059f8f1e1
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Aug 29 17:53:09 2026 +0800
Consolidate database protocol exceptions (#39634)
---
.../protocol/DatabaseProtocolException.java | 6 ++--
.../constant/buffer/FirebirdParameterBuffer.java | 4 +--
.../exception/FirebirdProtocolException.java | 32 ----------------------
.../batch/FirebirdBatchCreateCommandPacket.java | 4 +--
.../command/query/batch/FirebirdParseBatchBlr.java | 6 ++--
.../FirebirdBatchBlobSegmentsCommandPacket.java | 6 ++--
.../type/blob/FirebirdBlobInfoReturnPacket.java | 4 +--
.../type/common/FirebirdCommonInfoPacketType.java | 6 ++--
.../database/FirebirdDatabaseInfoReturnPacket.java | 4 +--
.../info/type/sql/FirebirdSQLInfoReturnPacket.java | 4 +--
.../prepare/FirebirdReturnColumnPacket.java | 4 +--
.../handshake/FirebirdSRPAuthenticationData.java | 6 ++--
.../buffer/FirebirdParameterBufferTest.java | 4 +--
.../FirebirdBatchCreateCommandPacketTest.java | 4 +--
.../query/batch/FirebirdParseBatchBlrTest.java | 4 +--
...FirebirdBatchBlobSegmentsCommandPacketTest.java | 6 ++--
.../blob/FirebirdBlobInfoReturnPacketTest.java | 6 ++--
.../common/FirebirdCommonInfoPacketTypeTest.java | 4 +--
.../FirebirdDatabaseInfoReturnPacketTest.java | 4 +--
.../type/sql/FirebirdSQLInfoReturnPacketTest.java | 4 +--
.../prepare/FirebirdReturnColumnPacketTest.java | 6 ++--
.../FirebirdSRPAuthenticationDataTest.java | 4 +--
.../constant/MySQLNewParametersBoundFlag.java | 6 ++--
.../mysql/exception/MySQLProtocolException.java | 32 ----------------------
.../constant/MySQLNewParametersBoundFlagTest.java | 4 +--
.../exception/PostgreSQLProtocolException.java | 32 ----------------------
.../command/PostgreSQLCommandPacketType.java | 6 ++--
.../query/extended/PostgreSQLBinaryColumnType.java | 6 ++--
.../extended/close/PostgreSQLComClosePacket.java | 6 ++--
.../identifier/PostgreSQLMessagePacketType.java | 6 ++--
.../command/PostgreSQLCommandPacketTypeTest.java | 4 +--
.../extended/PostgreSQLBinaryColumnTypeTest.java | 6 ++--
.../close/PostgreSQLComClosePacketTest.java | 4 +--
.../PostgreSQLMessagePacketTypeTest.java | 4 +--
.../FirebirdAuthenticationEngine.java | 4 +--
.../batch/FirebirdBatchCreateCommandExecutor.java | 10 +++----
.../blob/FirebirdSeekBlobCommandExecutor.java | 4 +--
.../generator/FirebirdBlobHandleGenerator.java | 14 +++++-----
.../free/FirebirdFreeStatementCommandExecutor.java | 4 +--
.../FirebirdPrepareStatementCommandExecutor.java | 4 +--
.../FirebirdAuthenticationEngineTest.java | 4 +--
.../FirebirdBatchCreateCommandExecutorTest.java | 14 +++++-----
.../FirebirdCancelBlobCommandExecutorTest.java | 6 ++--
.../blob/FirebirdCloseBlobCommandExecutorTest.java | 6 ++--
.../blob/FirebirdSeekBlobCommandExecutorTest.java | 4 +--
.../generator/FirebirdBlobHandleGeneratorTest.java | 10 +++----
.../FirebirdFreeStatementCommandExecutorTest.java | 4 +--
47 files changed, 120 insertions(+), 216 deletions(-)
diff --git a/database/exception/core/src/main/java/org/apache/shardingsphere/database/exception/core/exception/protocol/DatabaseProtocolException.java b/database/exception/core/src/main/java/org/apache/shardingsphere/database/exception/core/exception/protocol/DatabaseProtocolException.java
index 13717d6dba7..2d6e1686dc2 100644
--- a/database/exception/core/src/main/java/org/apache/shardingsphere/database/exception/core/exception/protocol/DatabaseProtocolException.java
+++ b/database/exception/core/src/main/java/org/apache/shardingsphere/database/exception/core/exception/protocol/DatabaseProtocolException.java
@@ -22,11 +22,11 @@ import org.apache.shardingsphere.database.exception.core.exception.SQLDialectExc
/**
* Database protocol exception.
*/
-public abstract class DatabaseProtocolException extends SQLDialectException {
+public final class DatabaseProtocolException extends SQLDialectException {
private static final long serialVersionUID = -6035033415978907492L;
- protected DatabaseProtocolException(final String reason) {
- super(reason);
+ public DatabaseProtocolException(final String reason, final Object... args) {
+ super(String.format(reason, args));
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java
index 5b01a435999..56f0c81dc17 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBuffer.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.database.protocol.firebird.constant.buffer;
import io.netty.buffer.ByteBuf;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
@@ -71,7 +71,7 @@ public final class FirebirdParameterBuffer {
int length = traditionalStyle ? parameterBuffer.readByte() : parameterBuffer.readIntLE();
return parameterBuffer.readSlice(length).toString(StandardCharsets.UTF_8);
default:
- throw new FirebirdProtocolException("Unsupported format type %s", type.getFormat().name());
+ throw new DatabaseProtocolException("Unsupported format type %s", type.getFormat().name());
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/exception/FirebirdProtocolException.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/exception/FirebirdProtocolException.java
deleted file mode 100644
index a2f75591259..00000000000
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/exception/FirebirdProtocolException.java
+++ /dev/null
@@ -1,32 +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.database.protocol.firebird.exception;
-
-import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
-
-/**
- * Firebird protocol exception.
- */
-public final class FirebirdProtocolException extends DatabaseProtocolException {
-
- private static final long serialVersionUID = -2345109476596144026L;
-
- public FirebirdProtocolException(final String reason, final Object... args) {
- super(String.format(reason, args));
- }
-}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacket.java
index bf4e7e1ab51..14a1bc088eb 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacket.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import io.netty.buffer.ByteBuf;
import lombok.Getter;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.FirebirdCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
@@ -42,7 +42,7 @@ public final class FirebirdBatchCreateCommandPacket extends FirebirdCommandPacke
statementHandle = payload.readInt4();
batchBlr = payload.readBuffer();
if (!batchBlr.isReadable()) {
- throw new FirebirdProtocolException("Missing required format info in createBatch()");
+ throw new DatabaseProtocolException("Missing required format info in createBatch()");
}
batchMessageLength = payload.readInt4Unsigned();
batchParametersBuffer = payload.readBuffer();
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java
index f4141be46f0..f5db2a3096b 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlr.java
@@ -21,7 +21,7 @@ import io.netty.buffer.ByteBuf;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.FirebirdBinaryColumnType;
import org.firebirdsql.gds.BlrConstants;
@@ -50,7 +50,7 @@ public final class FirebirdParseBatchBlr {
* @param blrLength BLR length
* @return parsed message format
* @throws IllegalArgumentException when BLR format is structurally invalid
- * @throws FirebirdProtocolException when BLR contains a field type that batch operations do not support yet
+ * @throws DatabaseProtocolException when BLR contains a field type that batch operations do not support yet
*/
public static FirebirdParseBatchBlr parse(final ByteBuf blr, final int blrLength) {
FirebirdParseBatchBlr result = parseForFraming(blr, blrLength);
@@ -112,7 +112,7 @@ public final class FirebirdParseBatchBlr {
for (FirebirdBatchColumnDescriptor each : fields) {
if (FirebirdBinaryColumnType.BLOB == each.getType()) {
// TODO Implement BATCH_REGBLOB, BATCH_BLOB_STREAM and BATCH_SET_BPB before accepting BLOB fields.
- throw new FirebirdProtocolException("BLOB fields are not supported in Firebird batch operations");
+ throw new DatabaseProtocolException("BLOB fields are not supported in Firebird batch operations");
}
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacket.java
index bb8f50d5bb8..e74199fa500 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacket.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import io.netty.buffer.ByteBuf;
import lombok.Getter;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.FirebirdCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
@@ -51,11 +51,11 @@ public final class FirebirdBatchBlobSegmentsCommandPacket extends FirebirdComman
Collection<byte[]> result = new LinkedList<>();
while (buffer.isReadable()) {
if (buffer.readableBytes() < Short.BYTES) {
- throw new FirebirdProtocolException("Truncated batch BLOB segment length");
+ throw new DatabaseProtocolException("Truncated batch BLOB segment length");
}
int segmentLength = buffer.readUnsignedShortLE();
if (buffer.readableBytes() < segmentLength) {
- throw new FirebirdProtocolException("Batch BLOB segment declares %d bytes, but only %d bytes remain", segmentLength, buffer.readableBytes());
+ throw new DatabaseProtocolException("Batch BLOB segment declares %d bytes, but only %d bytes remain", segmentLength, buffer.readableBytes());
}
byte[] segmentData = new byte[segmentLength];
buffer.readBytes(segmentData);
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacket.java
index c81640e098a..025bb7fd017 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacket.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.FirebirdPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.FirebirdInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
@@ -68,7 +68,7 @@ public final class FirebirdBlobInfoReturnPacket extends FirebirdPacket {
writeIntValue(payload, type, BLOB_TYPE_SEGMENTED);
return;
default:
- throw new FirebirdProtocolException("Unknown blob information request type %d", type.getCode());
+ throw new DatabaseProtocolException("Unknown blob information request type %d", type.getCode());
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketType.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketType.java
index 9f9a9cdfe5e..0e38f8ed436 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketType.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketType.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.FirebirdInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
@@ -68,7 +68,7 @@ public enum FirebirdCommonInfoPacketType implements FirebirdInfoPacketType {
*
* @param data payload to write data to
* @param type type of common info packet
- * @throws FirebirdProtocolException if the common info packet type is unknown
+ * @throws DatabaseProtocolException if the common info packet type is unknown
*/
public static void parseCommonInfo(final FirebirdPacketPayload data, final FirebirdCommonInfoPacketType type) {
// TODO implement other request types handle
@@ -77,7 +77,7 @@ public enum FirebirdCommonInfoPacketType implements FirebirdInfoPacketType {
data.writeInt1(END.getCode());
break;
default:
- throw new FirebirdProtocolException("Unknown common information request type %d", type.getCode());
+ throw new DatabaseProtocolException("Unknown common information request type %d", type.getCode());
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacket.java
index cb5f0c83b07..83abba75bf5 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacket.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdArchType;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.FirebirdPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.FirebirdInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
@@ -98,7 +98,7 @@ public final class FirebirdDatabaseInfoReturnPacket extends FirebirdPacket {
data.writeBytes(FB_VERSION.getBytes(StandardCharsets.UTF_8));
break;
default:
- throw new FirebirdProtocolException("Unknown database information request type %d", type.getCode());
+ throw new DatabaseProtocolException("Unknown database information request type %d", type.getCode());
}
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacket.java
index b7564b10587..4bfcd23a9b3 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacket.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.FirebirdPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.FirebirdInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
@@ -68,7 +68,7 @@ public final class FirebirdSQLInfoReturnPacket extends FirebirdPacket {
processRecords(payload);
return;
default:
- throw new FirebirdProtocolException("Unknown database information request type %d", type.getCode());
+ throw new DatabaseProtocolException("Unknown database information request type %d", type.getCode());
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacket.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacket.java
index 154e531a481..9a4ee651a47 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacket.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacket.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.statement.prepare;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.FirebirdPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.FirebirdBinaryColumnType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.sql.FirebirdSQLInfoPacketType;
@@ -106,7 +106,7 @@ public final class FirebirdReturnColumnPacket extends FirebirdPacket {
FirebirdPrepareStatementReturnPacket.writeCode(FirebirdSQLInfoPacketType.DESCRIBE_END, payload);
break;
default:
- throw new FirebirdProtocolException("Unknown statement info request type %d", requestedItem);
+ throw new DatabaseProtocolException("Unknown statement info request type %d", requestedItem);
}
}
}
diff --git a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationData.java b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationData.java
index 7aa48aad68b..eb29a1664c8 100644
--- a/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationData.java
+++ b/database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationData.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.handshake;
import lombok.Getter;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.firebirdsql.util.ByteArrayHelper;
import java.math.BigInteger;
@@ -196,7 +196,7 @@ public final class FirebirdSRPAuthenticationData {
return ByteArrayHelper.toHexString(pad(publicKey));
}
- private byte[] clientProofHash(final byte[]... arrays) throws FirebirdProtocolException {
+ private byte[] clientProofHash(final byte[]... arrays) {
try {
MessageDigest md = MessageDigest.getInstance(clientProofHashAlgorithm);
for (byte[] array : arrays) {
@@ -204,7 +204,7 @@ public final class FirebirdSRPAuthenticationData {
}
return md.digest();
} catch (final NoSuchAlgorithmException ex) {
- throw new FirebirdProtocolException("Unrecognised hash algorithm `%s`.", clientProofHashAlgorithm);
+ throw new DatabaseProtocolException("Unrecognised hash algorithm `%s`.", clientProofHashAlgorithm);
}
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBufferTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBufferTest.java
index 45d9124ad05..a86200ebef9 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBufferTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/constant/buffer/FirebirdParameterBufferTest.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.database.protocol.firebird.constant.buffer;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdValueFormat;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -103,7 +103,7 @@ class FirebirdParameterBufferTest {
buffer.writeByte(1);
buffer.writeByte(4);
FirebirdParameterBuffer parameterBuffer = new FirebirdParameterBuffer(createValueOf(), version -> version == 1);
- assertThrows(FirebirdProtocolException.class, () -> parameterBuffer.parseBuffer(buffer));
+ assertThrows(DatabaseProtocolException.class, () -> parameterBuffer.parseBuffer(buffer));
}
private Function<Integer, FirebirdParameterBufferType> createValueOf() {
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacketTest.java
index b5d8357f586..52cfddef99b 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdBatchCreateCommandPacketTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch;
import io.netty.buffer.ByteBuf;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.junit.jupiter.api.Test;
@@ -54,7 +54,7 @@ class FirebirdBatchCreateCommandPacketTest {
ByteBuf blrBuffer = mock(ByteBuf.class);
when(payload.readBuffer()).thenReturn(blrBuffer);
when(blrBuffer.isReadable()).thenReturn(false);
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdBatchCreateCommandPacket(payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdBatchCreateCommandPacket(payload));
verify(payload).skipReserved(4);
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlrTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlrTest.java
index 29cdd504bc8..ae6fa987693 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlrTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/batch/FirebirdParseBatchBlrTest.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.firebird.packet.command.quer
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.FirebirdBinaryColumnType;
import org.firebirdsql.gds.BlrConstants;
import org.junit.jupiter.api.Test;
@@ -113,7 +113,7 @@ class FirebirdParseBatchBlrTest {
@MethodSource("blobFieldArguments")
void assertParseRejectsBlob(final String name, final byte[] fieldBlr, final int scale) {
ByteBuf blr = createBlr(BlrConstants.blr_version5, fieldBlr, 2);
- FirebirdProtocolException actual = assertThrows(FirebirdProtocolException.class, () -> FirebirdParseBatchBlr.parse(blr, blr.readableBytes()));
+ DatabaseProtocolException actual = assertThrows(DatabaseProtocolException.class, () -> FirebirdParseBatchBlr.parse(blr, blr.readableBytes()));
assertThat(actual.getMessage(), is("BLOB fields are not supported in Firebird batch operations"));
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacketTest.java
index 3cec604c060..f2ddd51ccf1 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/blob/FirebirdBatchBlobSegmentsCommandPacketTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.blob;
import io.netty.buffer.Unpooled;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -74,7 +74,7 @@ class FirebirdBatchBlobSegmentsCommandPacketTest {
when(payload.readBlobHandle()).thenReturn(11);
when(payload.readInt4()).thenReturn(1);
when(payload.readBuffer()).thenReturn(Unpooled.wrappedBuffer(new byte[]{1}));
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdBatchBlobSegmentsCommandPacket(payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdBatchBlobSegmentsCommandPacket(payload));
}
@Test
@@ -82,7 +82,7 @@ class FirebirdBatchBlobSegmentsCommandPacketTest {
when(payload.readBlobHandle()).thenReturn(11);
when(payload.readInt4()).thenReturn(3);
when(payload.readBuffer()).thenReturn(Unpooled.wrappedBuffer(new byte[]{3, 0, 1}));
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdBatchBlobSegmentsCommandPacket(payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdBatchBlobSegmentsCommandPacket(payload));
}
@Test
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacketTest.java
index 414cb637ba1..cd648b53b0f 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/blob/FirebirdBlobInfoReturnPacketTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.blob;
import lombok.SneakyThrows;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.FirebirdInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
@@ -83,7 +83,7 @@ class FirebirdBlobInfoReturnPacketTest {
@Test
void assertWriteCommonInfoWithUnsupportedType() {
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdBlobInfoReturnPacket(Collections.singletonList(FirebirdCommonInfoPacketType.TRUNCATED), 0).write((PacketPayload) payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdBlobInfoReturnPacket(Collections.singletonList(FirebirdCommonInfoPacketType.TRUNCATED), 0).write((PacketPayload) payload));
}
@Test
@@ -93,7 +93,7 @@ class FirebirdBlobInfoReturnPacketTest {
int actualSwitchValue = switchMap[typeIndex];
switchMap[typeIndex] = 0;
try {
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdBlobInfoReturnPacket(Collections.singletonList(FirebirdBlobInfoPacketType.TYPE), 0).write((PacketPayload) payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdBlobInfoReturnPacket(Collections.singletonList(FirebirdBlobInfoPacketType.TYPE), 0).write((PacketPayload) payload));
} finally {
switchMap[typeIndex] = actualSwitchValue;
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
index 47cfeb9b618..b4b018e7c48 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/common/FirebirdCommonInfoPacketTypeTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -49,7 +49,7 @@ class FirebirdCommonInfoPacketTypeTest {
@Test
void assertParseCommonInfoWithUnknownType() {
- assertThrows(FirebirdProtocolException.class, () -> FirebirdCommonInfoPacketType.parseCommonInfo(payload, FirebirdCommonInfoPacketType.ERROR));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdCommonInfoPacketType.parseCommonInfo(payload, FirebirdCommonInfoPacketType.ERROR));
}
@Test
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacketTest.java
index b707e20794b..5700c04673f 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/database/FirebirdDatabaseInfoReturnPacketTest.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.database;
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdArchType;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.junit.jupiter.api.Test;
@@ -72,7 +72,7 @@ class FirebirdDatabaseInfoReturnPacketTest {
@Test
void assertParseDatabaseInfoWithUnknownType() {
- assertThrows(FirebirdProtocolException.class, () -> new FirebirdDatabaseInfoReturnPacket(Collections.singletonList(FirebirdDatabaseInfoPacketType.DB_ID)).write(payload));
+ assertThrows(DatabaseProtocolException.class, () -> new FirebirdDatabaseInfoReturnPacket(Collections.singletonList(FirebirdDatabaseInfoPacketType.DB_ID)).write(payload));
}
@Test
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacketTest.java
index 6cb9d150bf5..01f934fc231 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/info/type/sql/FirebirdSQLInfoReturnPacketTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.sql;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.common.FirebirdCommonInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
import org.junit.jupiter.api.Test;
@@ -72,6 +72,6 @@ class FirebirdSQLInfoReturnPacketTest {
@Test
void assertParseSQLInfoWithUnknownType() {
FirebirdSQLInfoReturnPacket packet = new FirebirdSQLInfoReturnPacket(Collections.singletonList(FirebirdSQLInfoPacketType.STMT_TYPE), new FirebirdSQLRecordsInfo(0L, 0L, 0L));
- assertThrows(FirebirdProtocolException.class, () -> packet.write(payload));
+ assertThrows(DatabaseProtocolException.class, () -> packet.write(payload));
}
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacketTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacketTest.java
index 85e95ccaa8d..1e42be964fa 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacketTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/command/query/statement/prepare/FirebirdReturnColumnPacketTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.command.query.statement.prepare;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.FirebirdBinaryColumnType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.sql.FirebirdSQLInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.payload.FirebirdPacketPayload;
@@ -94,8 +94,8 @@ class FirebirdReturnColumnPacketTest {
@Test
void assertWriteWithUnsupportedRequestedItem() {
FirebirdReturnColumnPacket packet = createPacket(Collections.singletonList(FirebirdSQLInfoPacketType.SELECT), Types.INTEGER, null, false, null);
- try (MockedConstruction<FirebirdProtocolException> ignored = mockConstruction(FirebirdProtocolException.class)) {
- assertThrows(FirebirdProtocolException.class, () -> packet.write(payload));
+ try (MockedConstruction<DatabaseProtocolException> ignored = mockConstruction(DatabaseProtocolException.class)) {
+ assertThrows(DatabaseProtocolException.class, () -> packet.write(payload));
}
}
diff --git a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationDataTest.java b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationDataTest.java
index 99af0808f4f..13216c7414b 100644
--- a/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationDataTest.java
+++ b/database/protocol/dialect/firebird/src/test/java/org/apache/shardingsphere/database/protocol/firebird/packet/handshake/FirebirdSRPAuthenticationDataTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.firebird.packet.handshake;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -68,7 +68,7 @@ class FirebirdSRPAuthenticationDataTest {
@Test
void assertServerProofWithUnknownHashAlgorithm() {
FirebirdSRPAuthenticationData actual = new FirebirdSRPAuthenticationData("SHA-0", "alice", "password", "04");
- assertThat(assertThrows(FirebirdProtocolException.class, () -> actual.serverProof("alice")).getMessage(), is("Unrecognised hash algorithm `SHA-0`."));
+ assertThat(assertThrows(DatabaseProtocolException.class, () -> actual.serverProof("alice")).getMessage(), is("Unrecognised hash algorithm `SHA-0`."));
}
@Test
diff --git a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
index eea4325a8c1..e536ca29214 100644
--- a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
+++ b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.mysql.constant;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.mysql.exception.MySQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
/**
* New parameters bound flag for MySQL.
@@ -39,7 +39,7 @@ public enum MySQLNewParametersBoundFlag {
*
* @param value value
* @return new parameters bound flag
- * @throws MySQLProtocolException MySQL protocol exception
+ * @throws DatabaseProtocolException database protocol exception
*/
public static MySQLNewParametersBoundFlag valueOf(final int value) {
for (MySQLNewParametersBoundFlag each : values()) {
@@ -47,6 +47,6 @@ public enum MySQLNewParametersBoundFlag {
return each;
}
}
- throw new MySQLProtocolException("Can not find value `%s` in new parameters bound flag.", value);
+ throw new DatabaseProtocolException("Can not find value `%s` in new parameters bound flag.", value);
}
}
diff --git a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/exception/MySQLProtocolException.java b/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/exception/MySQLProtocolException.java
deleted file mode 100644
index b09c7274fe9..00000000000
--- a/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/exception/MySQLProtocolException.java
+++ /dev/null
@@ -1,32 +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.database.protocol.mysql.exception;
-
-import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
-
-/**
- * MySQL protocol exception.
- */
-public final class MySQLProtocolException extends DatabaseProtocolException {
-
- private static final long serialVersionUID = -2955235917749217233L;
-
- public MySQLProtocolException(final String reason, final Object... args) {
- super(String.format(reason, args));
- }
-}
diff --git a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
index 96d257a4fb5..8e8e557c633 100644
--- a/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
+++ b/database/protocol/dialect/mysql/src/test/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlagTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.mysql.constant;
-import org.apache.shardingsphere.database.protocol.mysql.exception.MySQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.is;
@@ -33,6 +33,6 @@ class MySQLNewParametersBoundFlagTest {
@Test
void assertValueOfWithIllegalArgument() {
- assertThrows(MySQLProtocolException.class, () -> MySQLNewParametersBoundFlag.valueOf(-1));
+ assertThrows(DatabaseProtocolException.class, () -> MySQLNewParametersBoundFlag.valueOf(-1));
}
}
diff --git a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/exception/PostgreSQLProtocolException.java b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/exception/PostgreSQLProtocolException.java
deleted file mode 100644
index d8186ee94fa..00000000000
--- a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/exception/PostgreSQLProtocolException.java
+++ /dev/null
@@ -1,32 +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.database.protocol.postgresql.exception;
-
-import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
-
-/**
- * PostgreSQL protocol exception.
- */
-public final class PostgreSQLProtocolException extends DatabaseProtocolException {
-
- private static final long serialVersionUID = -2345109476596144026L;
-
- public PostgreSQLProtocolException(final String reason, final Object... args) {
- super(String.format(reason, args));
- }
-}
diff --git a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
index a5a7f815f55..1d9d8f78bbf 100644
--- a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
+++ b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketType.java
@@ -20,7 +20,7 @@ package org.apache.shardingsphere.database.protocol.postgresql.packet.command;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.database.protocol.packet.command.CommandPacketType;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
import java.util.EnumSet;
@@ -65,7 +65,7 @@ public enum PostgreSQLCommandPacketType implements CommandPacketType, PostgreSQL
*
* @param value integer value
* @return command packet type enum
- * @throws PostgreSQLProtocolException PostgreSQL protocol exception
+ * @throws DatabaseProtocolException database protocol exception
*/
public static PostgreSQLCommandPacketType valueOf(final int value) {
for (PostgreSQLCommandPacketType each : values()) {
@@ -73,7 +73,7 @@ public enum PostgreSQLCommandPacketType implements CommandPacketType, PostgreSQL
return each;
}
}
- throw new PostgreSQLProtocolException("Can not find `%s` in PostgreSQL command packet type.", value);
+ throw new DatabaseProtocolException("Can not find `%s` in PostgreSQL command packet type.", value);
}
/**
diff --git a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnType.java b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnType.java
index 29ff7fed06b..f941724b4db 100644
--- a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnType.java
+++ b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnType.java
@@ -21,7 +21,7 @@ import com.google.common.base.Preconditions;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.database.protocol.binary.BinaryColumnType;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended.bind.protocol.text.PostgreSQLTextValueParser;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended.bind.protocol.text.impl.PostgreSQLBitValueParser;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended.bind.protocol.text.impl.PostgreSQLBoolValueParser;
@@ -268,7 +268,7 @@ public enum PostgreSQLBinaryColumnType implements BinaryColumnType {
*
* @param value value
* @return PostgreSQL column type
- * @throws PostgreSQLProtocolException PostgreSQL protocol exception
+ * @throws DatabaseProtocolException database protocol exception
*/
public static PostgreSQLBinaryColumnType valueOf(final int value) {
for (PostgreSQLBinaryColumnType each : values()) {
@@ -276,6 +276,6 @@ public enum PostgreSQLBinaryColumnType implements BinaryColumnType {
return each;
}
}
- throw new PostgreSQLProtocolException("Can not find value `%s` in PostgreSQL column type.", value);
+ throw new DatabaseProtocolException("Can not find value `%s` in PostgreSQL column type.", value);
}
}
diff --git a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
index 39e156c859e..4a9f6cb4c98 100644
--- a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
+++ b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacket.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.postgresql.packet.command.qu
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.PostgreSQLCommandPacket;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import org.apache.shardingsphere.database.protocol.postgresql.packet.identifier.PostgreSQLIdentifierTag;
@@ -64,7 +64,7 @@ public final class PostgreSQLComClosePacket extends PostgreSQLCommandPacket {
*
* @param type type char
* @return type
- * @throws PostgreSQLProtocolException PostgreSQL protocol exception
+ * @throws DatabaseProtocolException database protocol exception
*/
public static Type valueOf(final char type) {
for (Type each : values()) {
@@ -72,7 +72,7 @@ public final class PostgreSQLComClosePacket extends PostgreSQLCommandPacket {
return each;
}
}
- throw new PostgreSQLProtocolException("Close type must be 'S' or 'P'. Got '%c'.", type);
+ throw new DatabaseProtocolException("Close type must be 'S' or 'P'. Got '%c'.", type);
}
}
}
diff --git a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
index db08c5c085a..490c008b116 100644
--- a/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
+++ b/database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketType.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.database.protocol.postgresql.packet.identifier
import lombok.Getter;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
/**
* Message packet for PostgreSQL.
@@ -97,7 +97,7 @@ public enum PostgreSQLMessagePacketType implements PostgreSQLIdentifierTag {
*
* @param value integer value
* @return command packet type enum
- * @throws PostgreSQLProtocolException PostgreSQL protocol exception
+ * @throws DatabaseProtocolException database protocol exception
*/
public static PostgreSQLMessagePacketType valueOf(final int value) {
for (PostgreSQLMessagePacketType each : values()) {
@@ -105,6 +105,6 @@ public enum PostgreSQLMessagePacketType implements PostgreSQLIdentifierTag {
return each;
}
}
- throw new PostgreSQLProtocolException("Can not find `%s` in PostgreSQL identifier tag type.", value);
+ throw new DatabaseProtocolException("Can not find `%s` in PostgreSQL identifier tag type.", value);
}
}
diff --git a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
index 0832199eeba..580c40b1654 100644
--- a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
+++ b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/PostgreSQLCommandPacketTypeTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.postgresql.packet.command;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -27,7 +27,7 @@ class PostgreSQLCommandPacketTypeTest {
@Test
void assertValueOfUnknownCommandPacketType() {
- assertThrows(PostgreSQLProtocolException.class, () -> PostgreSQLCommandPacketType.valueOf(-1));
+ assertThrows(DatabaseProtocolException.class, () -> PostgreSQLCommandPacketType.valueOf(-1));
}
@Test
diff --git a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnTypeTest.java b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnTypeTest.java
index 65f62b14505..eb8f1554859 100644
--- a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnTypeTest.java
+++ b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnTypeTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
@@ -73,8 +73,8 @@ class PostgreSQLBinaryColumnTypeTest {
}
@Test
- void assertValueOfThrowsPostgreSQLProtocolException() {
- assertThrows(PostgreSQLProtocolException.class, () -> PostgreSQLBinaryColumnType.valueOf(9999));
+ void assertValueOfThrowsDatabaseProtocolException() {
+ assertThrows(DatabaseProtocolException.class, () -> PostgreSQLBinaryColumnType.valueOf(9999));
}
private static Stream<Arguments> assertValueOfJDBCTypeArguments() {
diff --git a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
index e9646e75663..b6a49600c5b 100644
--- a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
+++ b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/close/PostgreSQLComClosePacketTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.postgresql.packet.command.query.extended.close;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.postgresql.packet.command.PostgreSQLCommandPacketType;
import org.apache.shardingsphere.database.protocol.postgresql.payload.PostgreSQLPacketPayload;
import org.junit.jupiter.api.Test;
@@ -59,7 +59,7 @@ class PostgreSQLComClosePacketTest {
@Test
void assertInvalidType() {
- assertThrows(PostgreSQLProtocolException.class, () -> new PostgreSQLComClosePacket(payload));
+ assertThrows(DatabaseProtocolException.class, () -> new PostgreSQLComClosePacket(payload));
}
private PostgreSQLComClosePacket newPacket(final char type, final String name) {
diff --git a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
index a717b4c778f..9449dc548a6 100644
--- a/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
+++ b/database/protocol/dialect/postgresql/src/test/java/org/apache/shardingsphere/database/protocol/postgresql/packet/identifier/PostgreSQLMessagePacketTypeTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.database.protocol.postgresql.packet.identifier;
-import org.apache.shardingsphere.database.protocol.postgresql.exception.PostgreSQLProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.is;
@@ -33,6 +33,6 @@ class PostgreSQLMessagePacketTypeTest {
@Test
void assertGetValueWithIllegalArgument() {
- assertThrows(PostgreSQLProtocolException.class, () -> PostgreSQLMessagePacketType.valueOf(-1));
+ assertThrows(DatabaseProtocolException.class, () -> PostgreSQLMessagePacketType.valueOf(-1));
}
}
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngine.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngine.java
index b5e8a2fd38b..d2efec1d371 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngine.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngine.java
@@ -31,7 +31,7 @@ import org.apache.shardingsphere.database.protocol.constant.CommonConstants;
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdAuthenticationMethod;
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdConstant;
import org.apache.shardingsphere.database.protocol.firebird.constant.protocol.FirebirdConnectionProtocolVersion;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.FirebirdCommandPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.handshake.FirebirdAcceptPacket;
@@ -88,7 +88,7 @@ public final class FirebirdAuthenticationEngine implements AuthenticationEngine
case CONT_AUTH:
// TODO implement CONT_AUTH
default:
- throw new FirebirdProtocolException("Wrong operation %s during authentication phase", type.name());
+ throw new DatabaseProtocolException("Wrong operation %s during authentication phase", type.name());
}
}
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java
index f82a9855dd9..65fcd176585 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.database.exception.firebird.exception.protocol.
import org.apache.shardingsphere.database.exception.firebird.exception.protocol.InvalidBatchMessageFormatException;
import org.apache.shardingsphere.database.exception.firebird.exception.protocol.InvalidBatchParameterVersionException;
import org.apache.shardingsphere.database.exception.firebird.exception.protocol.InvalidStatementHandleException;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdBatchCreateCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdParseBatchBlr;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
@@ -137,7 +137,7 @@ public final class FirebirdBatchCreateCommandExecutor implements CommandExecutor
// int requestedBlobPolicy = readIntegerValue(reader, tag, valueLength);
// blobPolicy = BLOB_STREAM == requestedBlobPolicy ? requestedBlobPolicy : BLOB_STREAM;
// TODO Support BLOB policy after implementing the Firebird batch BLOB subprotocol.
- throw new FirebirdProtocolException("BLOB policy is not supported in Firebird batch operations");
+ throw new DatabaseProtocolException("BLOB policy is not supported in Firebird batch operations");
} else {
reader.skipBytes(valueLength);
}
@@ -153,19 +153,19 @@ public final class FirebirdBatchCreateCommandExecutor implements CommandExecutor
private static void ensureClumpletHeaderReadable(final ByteBuf reader) {
if (reader.readableBytes() < 1 + WIDE_CLUMPLET_LENGTH_SIZE) {
- throw new FirebirdProtocolException("Invalid batch parameters buffer");
+ throw new DatabaseProtocolException("Invalid batch parameters buffer");
}
}
private static void ensureClumpletValueReadable(final ByteBuf reader, final int tag, final int valueLength) {
if (valueLength < 0 || valueLength > reader.readableBytes()) {
- throw new FirebirdProtocolException("Invalid batch parameter length for tag %d: %d", tag, valueLength);
+ throw new DatabaseProtocolException("Invalid batch parameter length for tag %d: %d", tag, valueLength);
}
}
private static int readIntegerValue(final ByteBuf reader, final int tag, final int valueLength) {
if (INTEGER_VALUE_LENGTH != valueLength) {
- throw new FirebirdProtocolException("Invalid batch parameter integer length for tag %d: %d", tag, valueLength);
+ throw new DatabaseProtocolException("Invalid batch parameter integer length for tag %d: %d", tag, valueLength);
}
return reader.readIntLE();
}
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutor.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutor.java
index 16a663704e0..c59d501215c 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutor.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.blob.FirebirdSeekBlobCommandPacket;
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
import org.apache.shardingsphere.proxy.frontend.command.executor.CommandExecutor;
@@ -35,6 +35,6 @@ public final class FirebirdSeekBlobCommandExecutor implements CommandExecutor {
@Override
public Collection<DatabasePacket> execute() {
- throw new FirebirdProtocolException("SEEK BLOB is not supported at the moment, blob handle: %d", packet.getBlobHandle());
+ throw new DatabaseProtocolException("SEEK BLOB is not supported at the moment, blob handle: %d", packet.getBlobHandle());
}
}
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGenerator.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGenerator.java
index bc15640054a..f07450d93b7 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGenerator.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGenerator.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob.gen
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.infra.exception.ShardingSpherePreconditions;
import java.util.BitSet;
@@ -67,16 +67,16 @@ public final class FirebirdBlobHandleGenerator {
*
* @param connectionId connection ID
* @return generated BLOB handle within the range 1 to {@code 0xFFFE}
- * @throws FirebirdProtocolException when connection is not registered or no free BLOB handle is available
+ * @throws DatabaseProtocolException when connection is not registered or no free BLOB handle is available
*/
public int nextBlobHandle(final int connectionId) {
ConnectionBlobHandles connectionBlobHandles = connectionRegistry.get(connectionId);
ShardingSpherePreconditions.checkState(null != connectionBlobHandles,
- () -> new FirebirdProtocolException("Connection %d is not registered.", connectionId));
+ () -> new DatabaseProtocolException("Connection %d is not registered.", connectionId));
synchronized (connectionBlobHandles) {
int handleIndex = connectionBlobHandles.handles.nextClearBit(connectionBlobHandles.searchPosition);
ShardingSpherePreconditions.checkState(MAX_OBJECT_HANDLE > handleIndex,
- () -> new FirebirdProtocolException("No free BLOB handles are available for connection %d.", connectionId));
+ () -> new DatabaseProtocolException("No free BLOB handles are available for connection %d.", connectionId));
connectionBlobHandles.handles.set(handleIndex);
connectionBlobHandles.lastBlobHandle = handleIndex + 1;
connectionBlobHandles.searchPosition = connectionBlobHandles.lastBlobHandle;
@@ -109,7 +109,7 @@ public final class FirebirdBlobHandleGenerator {
*
* @param connectionId connection ID
* @param blobHandle BLOB handle
- * @throws FirebirdProtocolException when BLOB handle is invalid
+ * @throws DatabaseProtocolException when BLOB handle is invalid
*/
public void releaseBlobHandle(final int connectionId, final int blobHandle) {
ConnectionBlobHandles connectionBlobHandles = connectionRegistry.get(connectionId);
@@ -117,10 +117,10 @@ public final class FirebirdBlobHandleGenerator {
return;
}
ShardingSpherePreconditions.checkState(0 < blobHandle && MAX_OBJECT_HANDLE >= blobHandle,
- () -> new FirebirdProtocolException("Invalid BLOB handle %d.", blobHandle));
+ () -> new DatabaseProtocolException("Invalid BLOB handle %d.", blobHandle));
synchronized (connectionBlobHandles) {
ShardingSpherePreconditions.checkState(connectionBlobHandles.handles.get(blobHandle - 1),
- () -> new FirebirdProtocolException("Invalid BLOB handle %d.", blobHandle));
+ () -> new DatabaseProtocolException("Invalid BLOB handle %d.", blobHandle));
int position = blobHandle - 1;
connectionBlobHandles.handles.clear(position);
connectionBlobHandles.searchPosition = Math.min(connectionBlobHandles.searchPosition, position);
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java
index cee0c66207a..e2dabb8ca33 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutor.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.statement.free;
import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.statement.FirebirdFreeStatementPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
@@ -54,7 +54,7 @@ public final class FirebirdFreeStatementCommandExecutor implements CommandExecut
FirebirdStatementResourceCleaner.clean(connectionSession, packet.getStatementId(), false);
break;
default:
- throw new FirebirdProtocolException("Unknown DSQL option type %d", packet.getOption());
+ throw new DatabaseProtocolException("Unknown DSQL option type %d", packet.getOption());
}
return Collections.singleton(new FirebirdGenericResponsePacket());
}
diff --git a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/prepare/FirebirdPrepareStatementCommandExecutor.java b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/prepare/FirebirdPrepareStatementCommandExecutor.java
index 67246f91ee5..dcc455f1074 100644
--- a/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/prepare/FirebirdPrepareStatementCommandExecutor.java
+++ b/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/prepare/FirebirdPrepareStatementCommandExecutor.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.database.connector.firebird.metadata.data.FirebirdBlobInfoRegistry;
import org.apache.shardingsphere.database.connector.firebird.metadata.data.FirebirdNonFixedLengthColumnSizeRegistry;
import org.apache.shardingsphere.database.exception.core.exception.syntax.database.NoDatabaseSelectedException;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.sql.FirebirdSQLInfoPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.info.type.sql.FirebirdSQLInfoReturnValue;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.statement.prepare.FirebirdPrepareStatementPacket;
@@ -162,7 +162,7 @@ public final class FirebirdPrepareStatementCommandExecutor implements CommandExe
}
break;
default:
- throw new FirebirdProtocolException("Unknown statement info request type %d", packet.getCurrentItem());
+ throw new DatabaseProtocolException("Unknown statement info request type %d", packet.getCurrentItem());
}
}
return Collections.singleton(new FirebirdGenericResponsePacket().setData(returnPacket));
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngineTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngineTest.java
index 353e82435c5..12392f461de 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngineTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/authentication/FirebirdAuthenticationEngineTest.java
@@ -32,7 +32,7 @@ import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdAut
import org.apache.shardingsphere.database.protocol.firebird.constant.FirebirdConstant;
import org.apache.shardingsphere.database.protocol.firebird.constant.protocol.FirebirdProtocol;
import org.apache.shardingsphere.database.protocol.firebird.constant.protocol.FirebirdProtocolVersion;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.FirebirdCommandPacketType;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.handshake.FirebirdAcceptPacket;
@@ -122,7 +122,7 @@ class FirebirdAuthenticationEngineTest {
AuthorityRule rule = mock(AuthorityRule.class);
mockProxyContext(rule, true);
FirebirdPacketPayload payload = mockFirebirdPayload(FirebirdCommandPacketType.CONT_AUTH);
- assertThrows(FirebirdProtocolException.class, () -> authenticationEngine.authenticate(context, payload));
+ assertThrows(DatabaseProtocolException.class, () -> authenticationEngine.authenticate(context, payload));
}
@ParameterizedTest(name = "{0}")
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutorTest.java
index 6d6d7b611e1..472186904b7 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutorTest.java
@@ -25,7 +25,7 @@ import org.apache.shardingsphere.database.exception.firebird.exception.protocol.
import org.apache.shardingsphere.database.exception.firebird.exception.protocol.InvalidBatchParameterVersionException;
import org.apache.shardingsphere.database.exception.firebird.exception.protocol.InvalidStatementHandleException;
import org.apache.shardingsphere.database.protocol.firebird.err.FirebirdErrorPacketFactory;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.FirebirdBinaryColumnType;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdBatchCreateCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdBatchRegistry;
@@ -197,7 +197,7 @@ class FirebirdBatchCreateCommandExecutorTest {
when(packet.getStatementHandle()).thenReturn(STATEMENT_ID);
when(connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(STATEMENT_ID)).thenReturn(preparedStatement);
when(packet.getBatchBlr()).thenReturn(createBlobBatchBlr());
- FirebirdProtocolException actual = assertThrows(FirebirdProtocolException.class, () -> new FirebirdBatchCreateCommandExecutor(packet, connectionSession).execute());
+ DatabaseProtocolException actual = assertThrows(DatabaseProtocolException.class, () -> new FirebirdBatchCreateCommandExecutor(packet, connectionSession).execute());
assertThat(actual.getMessage(), is("BLOB fields are not supported in Firebird batch operations"));
assertNull(FirebirdBatchRegistry.getInstance().getBatchStatement(CONNECTION_ID, STATEMENT_ID));
}
@@ -209,7 +209,7 @@ class FirebirdBatchCreateCommandExecutorTest {
when(packet.getStatementHandle()).thenReturn(STATEMENT_ID);
when(connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(STATEMENT_ID)).thenReturn(preparedStatement);
when(packet.getBatchBlr()).thenReturn(createBlobBatchBlr());
- FirebirdProtocolException cause = assertThrows(FirebirdProtocolException.class, () -> new FirebirdBatchCreateCommandExecutor(packet, connectionSession).execute());
+ DatabaseProtocolException cause = assertThrows(DatabaseProtocolException.class, () -> new FirebirdBatchCreateCommandExecutor(packet, connectionSession).execute());
FirebirdGenericResponsePacket errorPacket = (FirebirdGenericResponsePacket) FirebirdErrorPacketFactory.newInstance(cause);
assertThat(errorPacket.getErrorMessage(), containsString("BLOB fields are not supported in Firebird batch operations"));
assertNull(FirebirdBatchRegistry.getInstance().getBatchStatement(CONNECTION_ID, STATEMENT_ID));
@@ -262,7 +262,7 @@ class FirebirdBatchCreateCommandExecutorTest {
@Test
void assertParseBatchParametersWithBlobPolicy() {
- FirebirdProtocolException actual = assertThrows(FirebirdProtocolException.class,
+ DatabaseProtocolException actual = assertThrows(DatabaseProtocolException.class,
() -> FirebirdBatchCreateCommandExecutor.BatchParameters.parse(createBatchParametersBuffer(TAG_BLOB_POLICY, BLOB_NONE)));
assertThat(actual.getMessage(), is("BLOB policy is not supported in Firebird batch operations"));
}
@@ -274,18 +274,18 @@ class FirebirdBatchCreateCommandExecutorTest {
@Test
void assertParseBatchParametersWhenClumpletTruncated() {
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBatchCreateCommandExecutor.BatchParameters.parse(Unpooled.wrappedBuffer(new byte[]{BATCH_VERSION_1, TAG_BUFFER_BYTES_SIZE})));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBatchCreateCommandExecutor.BatchParameters.parse(Unpooled.wrappedBuffer(new byte[]{BATCH_VERSION_1, TAG_BUFFER_BYTES_SIZE})));
}
@Test
void assertParseBatchParametersWhenValueTruncated() {
- assertThrows(FirebirdProtocolException.class,
+ assertThrows(DatabaseProtocolException.class,
() -> FirebirdBatchCreateCommandExecutor.BatchParameters.parse(Unpooled.buffer().writeByte(BATCH_VERSION_1).writeByte(TAG_BUFFER_BYTES_SIZE).writeIntLE(4)));
}
@Test
void assertParseBatchParametersWhenIntegerLengthInvalid() {
- assertThrows(FirebirdProtocolException.class,
+ assertThrows(DatabaseProtocolException.class,
() -> FirebirdBatchCreateCommandExecutor.BatchParameters.parse(Unpooled.buffer().writeByte(BATCH_VERSION_1).writeByte(TAG_BUFFER_BYTES_SIZE).writeIntLE(1).writeByte(1)));
}
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
index 0a5869c998f..547e23e8eb6 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCancelBlobCommandExecutorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.blob.FirebirdCancelBlobCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
@@ -81,7 +81,7 @@ class FirebirdCancelBlobCommandExecutorTest {
assertThat(response, isA(FirebirdGenericResponsePacket.class));
assertThat(((FirebirdGenericResponsePacket) response).getHandle(), is(0));
assertFalse(FirebirdBlobWriteCache.getInstance().getBlobId(CONNECTION_ID, blobHandle).isPresent());
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
}
@Test
@@ -90,6 +90,6 @@ class FirebirdCancelBlobCommandExecutorTest {
when(packet.getBlobHandle()).thenReturn(blobHandle);
Collection<DatabasePacket> actual = new FirebirdCancelBlobCommandExecutor(packet, connectionSession).execute();
assertThat(actual.size(), is(1));
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
}
}
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCloseBlobCommandExecutorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCloseBlobCommandExecutorTest.java
index f6d5b4a0814..cfaebad7236 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCloseBlobCommandExecutorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdCloseBlobCommandExecutorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.blob.FirebirdCloseBlobCommandPacket;
import org.apache.shardingsphere.database.protocol.firebird.packet.generic.FirebirdGenericResponsePacket;
import org.apache.shardingsphere.database.protocol.packet.DatabasePacket;
@@ -83,7 +83,7 @@ class FirebirdCloseBlobCommandExecutorTest {
assertThat(response, isA(FirebirdGenericResponsePacket.class));
assertThat(((FirebirdGenericResponsePacket) response).getHandle(), is(0));
assertThat(((FirebirdGenericResponsePacket) response).getId(), is(blobId));
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
}
@Test
@@ -92,6 +92,6 @@ class FirebirdCloseBlobCommandExecutorTest {
when(packet.getBlobHandle()).thenReturn(blobHandle);
Collection<DatabasePacket> actual = new FirebirdCloseBlobCommandExecutor(packet, connectionSession).execute();
assertThat(((FirebirdGenericResponsePacket) actual.iterator().next()).getId(), is(0L));
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
}
}
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutorTest.java
index a8b6053e98e..015af357624 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/FirebirdSeekBlobCommandExecutorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.blob.FirebirdSeekBlobCommandPacket;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
@@ -39,7 +39,7 @@ class FirebirdSeekBlobCommandExecutorTest {
void assertExecuteThrowsUnsupported() {
when(packet.getBlobHandle()).thenReturn(42);
FirebirdSeekBlobCommandExecutor executor = new FirebirdSeekBlobCommandExecutor(packet);
- FirebirdProtocolException actual = assertThrows(FirebirdProtocolException.class, executor::execute);
+ DatabaseProtocolException actual = assertThrows(DatabaseProtocolException.class, executor::execute);
assertThat(actual.getMessage(), is("SEEK BLOB is not supported at the moment, blob handle: 42"));
}
}
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGeneratorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGeneratorTest.java
index 3daacdcd689..f434e78db99 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGeneratorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/blob/generator/FirebirdBlobHandleGeneratorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.blob.generator;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -64,13 +64,13 @@ class FirebirdBlobHandleGeneratorTest {
for (int i = 1; i < MAX_OBJECT_HANDLE; i++) {
generator.nextBlobHandle(CONNECTION_ID);
}
- assertThrows(FirebirdProtocolException.class, () -> generator.nextBlobHandle(CONNECTION_ID));
+ assertThrows(DatabaseProtocolException.class, () -> generator.nextBlobHandle(CONNECTION_ID));
}
@Test
void assertNextBlobHandleWhenConnectionIsNotRegistered() {
FirebirdBlobHandleGenerator.getInstance().unregisterConnection(CONNECTION_ID);
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().nextBlobHandle(CONNECTION_ID));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().nextBlobHandle(CONNECTION_ID));
}
@Test
@@ -139,12 +139,12 @@ class FirebirdBlobHandleGeneratorTest {
@ParameterizedTest(name = "{0}")
@MethodSource("invalidBlobHandleProvider")
void assertReleaseBlobHandleWhenHandleIsOutsideValidRange(final String name, final int blobHandle) {
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, blobHandle));
}
@Test
void assertReleaseBlobHandleWhenHandleIsNotActive() {
- assertThrows(FirebirdProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, 1));
+ assertThrows(DatabaseProtocolException.class, () -> FirebirdBlobHandleGenerator.getInstance().releaseBlobHandle(CONNECTION_ID, 1));
}
@Test
diff --git a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutorTest.java b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutorTest.java
index 94d7b9fd209..238c1f743ed 100644
--- a/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutorTest.java
+++ b/proxy/frontend/dialect/firebird/src/test/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/statement/free/FirebirdFreeStatementCommandExecutorTest.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.proxy.frontend.firebird.command.query.statement.free;
-import org.apache.shardingsphere.database.protocol.firebird.exception.FirebirdProtocolException;
+import org.apache.shardingsphere.database.exception.core.exception.protocol.DatabaseProtocolException;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdBatchRegistry;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.batch.FirebirdBatchStatement;
import org.apache.shardingsphere.database.protocol.firebird.packet.command.query.statement.FirebirdFreeStatementPacket;
@@ -127,7 +127,7 @@ class FirebirdFreeStatementCommandExecutorTest {
@Test
void assertExecuteWithUnknownOption() {
when(packet.getOption()).thenReturn(999);
- assertThrows(FirebirdProtocolException.class, new FirebirdFreeStatementCommandExecutor(packet, connectionSession)::execute);
+ assertThrows(DatabaseProtocolException.class, new FirebirdFreeStatementCommandExecutor(packet, connectionSession)::execute);
}
private static Stream<Arguments> preparedStatementFreeOptions() {