Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
FatalActivityExecutionException when I use html entities in command

I have a room listener as follows:
@Slash(value = "( .* )", mentionBot = false)
public void commandHandler(CommandContext ctx){...}

When I enter a command with any of the html entities & < > " '
It fails to read and gives following error:
[Fatal Error] :1:112 The entity name must immediately follow the '&' in the entity reference.
FatalActivityExecutionException: Unable to parse PresentationML

I tried replacing these values with the escape values eg putting & amp; as replacement of &
This seems to be working for me but why can I not use the html entities directly? Is there a work around to make this work?
Command that I had entered: #ref %^^&*&

Posted 2 years ago
Edited 2 years ago
Votes Newest

Answers 2

thanks for your suggestion, will look to upgrade bdk to latest version.
For now upgrading to bdk 2.3.1 has resolved my issue.

Posted 2 years ago

You didn't share your method body, but I suspect you're trying to echo the incoming message back into the room. The exception you see is not due to the incoming format but the outgoing format.

When sending messages, all special characters have to be escaped, as you have found. You can review the docs at this page:

Posted 2 years ago
Yong Sheng Tan
39 × 2 Administrator

The issue is not while responding to the message as I am not using any of the xml entities in my responses.
Please refer the error log: Error

Ali Rizvi   2 years ago Report

Continuation of error log: Error

It doesnt enter my listener function commandHandler. Fails before entering.

Ali Rizvi   2 years ago Report

My bad - I didn't realise you were using a regex in your pattern - that is no longer supported since 2.5.0 when arguments were introduced. there was also a fix for escape sequences in the interim but you should look at upgrading to the latest version of BDK. if you require a custom matcher (including regex), you will need to build a custom class that extends CommandActivity<CommandContext> and define an override to matcher()

Yong Sheng Tan   2 years ago Report
2 Answers
2 years ago
2 years ago