This is an automated email from the ASF dual-hosted git repository. clebertsuconic pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/activemq-artemis.git
commit 88b7ee36a3f25d95ecbc111306aab3c5d11d2c9a Author: Clebert Suconic <[email protected]> AuthorDate: Wed May 13 10:46:06 2020 -0400 ARTEMIS-2761 Supporting Quoted IDs to allow complex names in AMQP copied/borrowed from https://github.com/apache/qpid-jms/commit/fd2139c27d96126f0cef9a6b55701f439b21f6dc --- artemis-selector/src/main/javacc/StrictParser.jj | 15 +++++++++++++++ .../apache/activemq/artemis/selector/SelectorTest.java | 10 ++++++++++ 2 files changed, 25 insertions(+) diff --git a/artemis-selector/src/main/javacc/StrictParser.jj b/artemis-selector/src/main/javacc/StrictParser.jj index 0a318ab..46e5c2b 100755 --- a/artemis-selector/src/main/javacc/StrictParser.jj +++ b/artemis-selector/src/main/javacc/StrictParser.jj @@ -131,6 +131,7 @@ TOKEN [IGNORE_CASE] : TOKEN [IGNORE_CASE] : { < ID : ["a"-"z", "_", "$"] (["a"-"z","0"-"9","_", "$"])* > + | < QUOTED_ID : "\"" ( ("\"\"") | ~["\""] )* "\"" > } // ---------------------------------------------------------------------------- @@ -556,6 +557,20 @@ PropertyExpression variable() : { left = new PropertyExpression(t.image); } + | + t = <QUOTED_ID> + { + // Decode the string value. + StringBuffer rc = new StringBuffer(); + String image = t.image; + for( int i=1; i < image.length()-1; i++ ) { + char c = image.charAt(i); + if( c == '"' ) + i++; + rc.append(c); + } + return new PropertyExpression(rc.toString()); + } ) { return left; diff --git a/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java index 7e6a9a6..5f1e4b8 100755 --- a/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java +++ b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java @@ -193,6 +193,16 @@ public class SelectorTest { } @Test + public void testDottedProperty() throws Exception { + MockMessage message = createMessage(); + message.setJMSType("selector-test"); + message.setStringProperty("a.test", "value"); + message.setJMSMessageID("id:test:1:1:1:1"); + + assertSelector(message, "\"a.test\" = 'value'", true); + } + + @Test public void testBasicSelectors() throws Exception { MockMessage message = createMessage();
