You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, If I try to build AlexaOutput with a $ symbol in the string, for example: AlexaOutput.ask("UtteranceKey").putSlot("slot1","$5.00"); the handler fails to error state with the exception: "io.klerch.alexa.tellask.util.AlexaRequestHandlerException: General error occured." A little debugging digs up the real issue: "java.lang.indexoutofboundsexception no group 3" which happens in the while loop starting on line 109 of AlexaSpeechletResponse.class in the method resolveSlotsInUtterance. This happens because the regex engine thinks "$5" is a token, it should be escaped before processing.
A workaround is to use "Matcher.quoteReplacement" in the input for the slot, for example:
AlexaOutput.ask("UtteranceKey").putSlot("slot1",Matcher.quoteReplacement("$5.00"));
While the workaround is sufficient for my purposes, it would be great if the library took care of this detail for me and I didn't have to worry about it. Thanks!
The text was updated successfully, but these errors were encountered:
Hi Ryan,
sorry for replying so late. Thanks for pointing this out. I'll consider to add this in an upcoming version of Tellask which will also contain AudioPlayer-features and compatibility with States SDK 1.0.0.
Meanwhile, feel free to contribute your workaround as a PR.
ryanhollander
added a commit
to ryanhollander/alexa-skills-kit-tellask-java
that referenced
this issue
Feb 5, 2017
Added "Matcher.quoteReplacement" to resolve of slot input in AlexaSpeechletResponse::resolveSlotsInUtterance.
Added test to confirm that slots with replacement text containing $ does not fail with exception
Added entry to utterance.yaml for test
Minor refactor of resolveSlotsInUtterance, broke out double lambda into a lambda & method to improve code readability (see inline comment)
Kay, no worries, we are all busy bees. :-) I've submitted a pull request with a fix and test. Hope that helps! Looking forward to the next revision of this SDK, keep up the great work.
My Best,
-Ryan
Hi, If I try to build AlexaOutput with a $ symbol in the string, for example: AlexaOutput.ask("UtteranceKey").putSlot("slot1","$5.00"); the handler fails to error state with the exception: "io.klerch.alexa.tellask.util.AlexaRequestHandlerException: General error occured." A little debugging digs up the real issue: "java.lang.indexoutofboundsexception no group 3" which happens in the while loop starting on line 109 of AlexaSpeechletResponse.class in the method resolveSlotsInUtterance. This happens because the regex engine thinks "$5" is a token, it should be escaped before processing.
A workaround is to use "Matcher.quoteReplacement" in the input for the slot, for example:
AlexaOutput.ask("UtteranceKey").putSlot("slot1",Matcher.quoteReplacement("$5.00"));
While the workaround is sufficient for my purposes, it would be great if the library took care of this detail for me and I didn't have to worry about it. Thanks!
The text was updated successfully, but these errors were encountered: