Copilot commented on code in PR #10487:
URL: https://github.com/apache/rocketmq/pull/10487#discussion_r3394859981


##########
broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:
##########
@@ -229,7 +229,10 @@ public static boolean isSystem(String topic, String group) 
{
     }
 
     public static TopicMessageType getMessageType(SendMessageRequestHeader 
requestHeader) {
-        Map<String, String> properties = 
MessageDecoder.string2messageProperties(requestHeader.getProperties());
+        return 
getMessageType(MessageDecoder.string2messageProperties(requestHeader.getProperties()));
+    }
+
+    public static TopicMessageType getMessageType(Map<String, String> 
properties) {
         String traFlag = 
properties.get(MessageConst.PROPERTY_TRANSACTION_PREPARED);

Review Comment:
   `getMessageType(Map<String, String>)` will throw a `NullPointerException` if 
`properties` is null. Because this is now a public method, it can be called 
directly with null. Add a defensive check (e.g., treat null as an empty map / 
NORMAL type) or document/enforce non-null via annotations and validation.



##########
broker/src/main/java/org/apache/rocketmq/broker/metrics/BrokerMetricsManager.java:
##########
@@ -229,7 +229,10 @@ public static boolean isSystem(String topic, String group) 
{
     }
 
     public static TopicMessageType getMessageType(SendMessageRequestHeader 
requestHeader) {
-        Map<String, String> properties = 
MessageDecoder.string2messageProperties(requestHeader.getProperties());
+        return 
getMessageType(MessageDecoder.string2messageProperties(requestHeader.getProperties()));
+    }
+
+    public static TopicMessageType getMessageType(Map<String, String> 
properties) {

Review Comment:
   This change introduces a new public static overload 
`getMessageType(Map<String, String>)`, which expands the class’s public API 
surface. If this overload is intended solely as an internal helper, make it 
`private` (or at least package-private) to avoid creating a new supported API 
that must be maintained for compatibility.



-- 
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