[ 
https://issues.apache.org/jira/browse/ARTEMIS-5182?focusedWorklogId=949118&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-949118
 ]

ASF GitHub Bot logged work on ARTEMIS-5182:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 19/Dec/24 08:42
            Start Date: 19/Dec/24 08:42
    Worklog Time Spent: 10m 
      Work Description: brusdev commented on code in PR #5408:
URL: https://github.com/apache/activemq-artemis/pull/5408#discussion_r1891359006


##########
artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java:
##########
@@ -566,7 +566,7 @@ StompPostReceiptFunction subscribe(String destination,
          if (selector == null) {
             selector = noLocalFilter;
          } else {
-            selector += " AND " + noLocalFilter;
+            selector = "(" + selector + ") AND " + noLocalFilter;

Review Comment:
   could selector be an empty string?





Issue Time Tracking
-------------------

    Worklog Id:     (was: 949118)
    Time Spent: 20m  (was: 10m)

> STOMP subscriber w/noLocal + selector missing messages
> ------------------------------------------------------
>
>                 Key: ARTEMIS-5182
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-5182
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: STOMP
>    Affects Versions: 2.37.0
>            Reporter: Tommy Lindgren
>            Assignee: Justin Bertram
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> If {{noLocal}} is enabled, {{StompConnection.java}} adds {{ AND 
> AMQ_CID<>xxx}} to the selector _without_ wrapping the original expression in 
> parentheses which means not all messages sent to the topic are filtered 
> properly.
> For example, if the original selector is {{{}foo=1 or bar=2{}}}, the new 
> selector will be {{foo=1 or bar=2 and __AMQ_CID<>xxx}}, so messages with only 
> {{foo=1}} won't respect {{noLocal}}.
> Untested potential patch:
> {noformat}
> diff --git 
> a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
>  
> b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> index 742c2a8d79..8527eea8a2 100644
> --- 
> a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> +++ 
> b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java
> @@ -566,7 +566,7 @@ public final class StompConnection extends 
> AbstractRemotingConnection {
>           if (selector == null) {
>              selector = noLocalFilter;
>           } else {
> -            selector += " AND " + noLocalFilter;
> +            selector = "(" + selector + ") AND " + noLocalFilter;
>           }
>        }{noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to