-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Abhijit Sarkar opened SPR-16351 and commented
DataBuffer write(DataBuffer... buffers) is supposed to "Write one or more DataBuffers to this buffer, starting at the current writing position" but it doesn't.
Consider buffer = "abc", slice = "def" and buffer.writePosition() = 3. buffer.write(slice) is supposed to produce abcdef but instead buffer becomes abcabc. The workaround is to use the write overload that takes a byte[], like so:
DataBuffer slice = buffer.slice(startIdx, length);
byte[] slice1 = new byte[length];
slice.read(slice1, 0, slice1.length);
buffer.write(slice1);
Related to SO answer https://stackoverflow.com/a/48111196/839733
Affects: 5.0.2
Reference URL: https://stackoverflow.com/a/48111196/839733
Issue Links:
- Using DataBuffer::write results in IndexOutOfBoundsException [SPR-16365] #20912 Using DataBuffer::write results in IndexOutOfBoundsException
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug