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

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


Copy link

@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();

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

Pull request:

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
in: web status: backported type: bug
None yet

No branches or pull requests

2 participants