congbobo184 commented on code in PR #18981:
URL: https://github.com/apache/pulsar/pull/18981#discussion_r1052829702


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageIdImpl.java:
##########
@@ -71,11 +72,14 @@ public int getBatchIndex() {
     @Override
     public int compareTo(@Nonnull MessageId o) {
         if (o instanceof MessageIdImpl) {
+            if (!(o instanceof BatchMessageIdImpl)) {
+                throw new 
UnsupportedOperationException(this.getClass().getName()

Review Comment:
   
https://github.com/apache/pulsar/blob/3177345ec4f9486993829950daa1dd9a3a75fd6f/pulsar-client/src/main/java/org/apache/pulsar/client/impl/BatchMessageIdImpl.java#L83
   
   this throw `UnsupportedOperationException `, We should throw the same 
exception, otherwise, the user needs to catch both exceptions. MessageIdImpl 
and BatchMessageIdImpl can compare not illegal arguments, It's just that we 
don't support it



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