mxsm commented on code in PR #5048:
URL: https://github.com/apache/rocketmq/pull/5048#discussion_r969060536


##########
broker/src/main/java/org/apache/rocketmq/broker/util/HookUtils.java:
##########
@@ -74,12 +74,7 @@ public static PutMessageResult 
checkBeforePutMessage(BrokerController brokerCont
         final byte[] topicData = 
msg.getTopic().getBytes(MessageDecoder.CHARSET_UTF8);
         final int topicLength = topicData == null ? 0 : topicData.length;
 
-        if (topicLength > 
brokerController.getMessageStoreConfig().getMaxTopicLength()) {
-            LOG.warn("putMessage message topic[{}] length too long {}", 
msg.getTopic(), topicLength);
-            return new PutMessageResult(PutMessageStatus.MESSAGE_ILLEGAL, 
null);
-        }
-
-        if (topicLength > Byte.MAX_VALUE) {
+        if (topicLength > Byte.MAX_VALUE || topicLength > 
brokerController.getMessageStoreConfig().getMaxTopicLength()) {

Review Comment:
   > > topicLength
   > 
   > OK, I find that even if it is not verified here, other places will verify 
that topic length does not exceed 127. So the maxTopicLength in 
messageStoreConfig is useless unless it is set to be less than 127.
   
   IMO, we add PutMessageHook to handle message which before put, so we should 
verify the length of the topic in PutMessageHook



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to