Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Minor
-
Resolution: Complete
-
Affects Version/s: 4.0.7, 4.1.1
-
Component/s: Messaging:WebSocket
-
Labels:None
-
Last commented by a User:true
Description
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:
https://github.com/spring-projects/spring-framework/pull/657