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

TextMessage.toString() throws StringIndexOutOfBoundsException if payload contains multibyte characters [SPR-12307] #16912

Closed
spring-projects-issues opened this issue Oct 7, 2014 · 0 comments
Assignees
Labels
in: web status: backported type: bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 7, 2014

Shinobu Aoki opened SPR-12307 and commented

TextMessage.toStringPayload throws StringIndexOutOfBoundsException if a payload-bytes is greater than 10 and a payload-length less than 10.
This method throws an exception in the following code.

new TextMessage("\u3042\u3044\u3046\u3048\u304a").toString();

Stacktrace:
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 10
at java.lang.String.substring(String.java:1950)
at org.springframework.web.socket.TextMessage.toStringPayload(TextMessage.java:79)
at org.springframework.web.socket.AbstractWebSocketMessage.toString(AbstractWebSocketMessage.java:91)
at samples.websocket.config.SampleWebSocketsApplication.main(SampleWebSocketsApplication.java:58)

Pull request:
#657


Affects: 4.0.7, 4.1.1

Referenced from: commits da14aee, da2c30c

Backported to: 4.0.8

@spring-projects-issues spring-projects-issues added type: bug status: backported in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web status: backported type: bug
Projects
None yet
Development

No branches or pull requests

2 participants