Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResponseBuilder trimOutputSpeech "<speak>" trimming #116

Closed
asymptotik opened this issue Jun 6, 2018 · 2 comments
Closed

ResponseBuilder trimOutputSpeech "<speak>" trimming #116

asymptotik opened this issue Jun 6, 2018 · 2 comments
Assignees
Labels

Comments

@asymptotik
Copy link

I'm submitting a...

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Other... Please describe:

The trimOutputSpeech method of the ResponseBuilder class is meant to trim the "" tags from the input. However, there is an error in:
if (trimmedOutputSpeech.startsWith("<speak>") && trimmedOutputSpeech.endsWith("</speak>")) {
return trimmedOutputSpeech.substring(8, trimmedOutputSpeech.length() - 8).trim();
}

The error is at the substring call with starting index of 8. The "<speak>" string only has 7 characters and a string has a starting index of 0. The character to the right of the ">" has an index of 7, not 8.

Expected Behavior

When setting ssml with the ResponseBuilder withSpeech method, the passed string should be able to contain enclosing <speak> markup.

The trimOutputSpeech method should only trim the <speak> tags and not any of the content.

Current Behavior

Any character to the right of an opening <speak> tag is trimmed.

Steps to Reproduce (for bugs)

// Provide a self-contained, concise snippet of code
// For more complex issues provide a repo with the smallest sample that reproduces the bug
// Including business logic or unrelated code makes diagnosis more difficult

Possible Solution

// Not required, but suggest a fix/reason for the bug,
// or ideas how to implement the addition or change

Context

Wasted my time tracking it down.

Your Environment

  • ASK Java SDK version used: 8.x.x
  • Operating System and version: mac os 10.12.6

Java Info

  • Java version used for development:
@sungolivia sungolivia added the bug label Jun 6, 2018
@sungolivia sungolivia self-assigned this Jun 6, 2018
@sungolivia
Copy link
Contributor

Closing this issue as the pull request above has been created addressing this bug. Please feel free to reopen if this bug persists.

@breedloj
Copy link
Contributor

breedloj commented Jun 7, 2018

Version 2.3.2 has been released containing this fix. Thanks again for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants