TextMessage.toString() throws StringIndexOutOfBoundsException if payload contains multibyte characters [SPR-12307] #16912
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
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.
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
The text was updated successfully, but these errors were encountered: