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 Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

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 A general bug status: backported An issue that has been backported to maintenance branches in: web Issues in web modules (web, webmvc, webflux, websocket) 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 Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants