diff --git a/java/client-shade/pom.xml b/java/client-shade/pom.xml
index ff8a9780d..5dc223ea4 100644
--- a/java/client-shade/pom.xml
+++ b/java/client-shade/pom.xml
@@ -42,8 +42,8 @@
rocketmq-client-java-noshade
- org.apache.tomcat
- annotations-api
+ jakarta.annotation
+ jakarta.annotation-api
diff --git a/java/client/pom.xml b/java/client/pom.xml
index a3ea357e5..3c8ceb49a 100644
--- a/java/client/pom.xml
+++ b/java/client/pom.xml
@@ -45,8 +45,8 @@
rocketmq-proto
- org.apache.tomcat
- annotations-api
+ jakarta.annotation
+ jakarta.annotation-api
io.grpc
diff --git a/java/client/src/main/java/org/apache/rocketmq/client/java/exception/PayloadEmptyException.java b/java/client/src/main/java/org/apache/rocketmq/client/java/exception/PayloadEmptyException.java
new file mode 100644
index 000000000..36be7b80c
--- /dev/null
+++ b/java/client/src/main/java/org/apache/rocketmq/client/java/exception/PayloadEmptyException.java
@@ -0,0 +1,29 @@
+/*
+ * 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.rocketmq.client.java.exception;
+
+import org.apache.rocketmq.client.apis.ClientException;
+
+/**
+ * Generic exception represents that the request entity is empty.
+ */
+public class PayloadEmptyException extends ClientException {
+ public PayloadEmptyException(int responseCode, String requestId, String message) {
+ super(responseCode, requestId, message);
+ }
+}
diff --git a/java/client/src/main/java/org/apache/rocketmq/client/java/exception/StatusChecker.java b/java/client/src/main/java/org/apache/rocketmq/client/java/exception/StatusChecker.java
index 76f5a225c..58e9cfc09 100644
--- a/java/client/src/main/java/org/apache/rocketmq/client/java/exception/StatusChecker.java
+++ b/java/client/src/main/java/org/apache/rocketmq/client/java/exception/StatusChecker.java
@@ -79,6 +79,8 @@ public static void check(Status status, RpcFuture, ?> future) throws ClientExc
case PAYLOAD_TOO_LARGE:
case MESSAGE_BODY_TOO_LARGE:
throw new PayloadTooLargeException(codeNumber, requestId, statusMessage);
+ case MESSAGE_BODY_EMPTY:
+ throw new PayloadEmptyException(codeNumber, requestId, statusMessage);
case TOO_MANY_REQUESTS:
throw new TooManyRequestsException(codeNumber, requestId, statusMessage);
case REQUEST_HEADER_FIELDS_TOO_LARGE:
diff --git a/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageBuilderImpl.java b/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageBuilderImpl.java
index 83cbb30c7..f5a066b2b 100644
--- a/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageBuilderImpl.java
+++ b/java/client/src/main/java/org/apache/rocketmq/client/java/message/MessageBuilderImpl.java
@@ -27,6 +27,7 @@
import java.util.HashSet;
import java.util.Map;
import java.util.regex.Pattern;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.apis.message.Message;
import org.apache.rocketmq.client.apis.message.MessageBuilder;
@@ -62,7 +63,7 @@ public MessageBuilder setTopic(String topic) {
*/
@Override
public MessageBuilder setBody(byte[] body) {
- checkNotNull(body, "body should not be null");
+ checkArgument(ArrayUtils.isNotEmpty(body), "body should not be empty");
this.body = body.clone();
return this;
}
diff --git a/java/pom.xml b/java/pom.xml
index ee05f650e..df27bfe00 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -48,8 +48,8 @@
~ 1. Whether it is essential, because the current shaded jar is fat enough.
~ 2. Make sure that it is compatible with Java 8.
-->
- 2.0.3
- 6.0.53
+ 2.0.4
+ 1.3.5
3.24.4
1.50.0
32.0.0-jre
@@ -110,26 +110,14 @@
${rocketmq-proto.version}
- io.grpc
- grpc-protobuf
-
-
- io.grpc
- grpc-stub
-
-
- io.grpc
- grpc-netty-shaded
-
-
- org.apache.tomcat
- annotations-api
+ *
+ *
- org.apache.tomcat
- annotations-api
+ jakarta.annotation
+ jakarta.annotation-api
${annotations-api.version}