[
https://issues.apache.org/jira/browse/SLING-3256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13831991#comment-13831991
]
Tobias Bocanegra commented on SLING-3256:
-----------------------------------------
on line 548, only {{read}} bytes should be written, not {{len}} :
{code}
543 while (position < end) {
544 int len = (int) Math.min(end - position, buffer.length);
545 int read = istream.read(buffer, 0, len);
546 if (read != -1) {
547 position += read;
548 ostream.write(buffer, 0, len);
549 } else {
550 break;
551 }
552 }
553 }
{code}
> Regression by SLING-3255: StreamRendererServlet writes wrong output
> -------------------------------------------------------------------
>
> Key: SLING-3256
> URL: https://issues.apache.org/jira/browse/SLING-3256
> Project: Sling
> Issue Type: Bug
> Components: Servlets
> Affects Versions: Servlets Get 2.1.4
> Reporter: Tobias Bocanegra
>
> the changes introduced by SLING-3255 contained a bug, which produces wrong
> output.
> on line 548, only {{read}} bytes should be written, not {{len}} :
> {code}
> 543 while (position < end) {
> 544 int len = (int) Math.min(end - position, buffer.length);
> 545 int read = istream.read(buffer, 0, len);
> 546 if (read != -1) {
> 547 position += read;
> 548 ostream.write(buffer, 0, len);
> 549 } else {
> 550 break;
> 551 }
> 552 }
> 553 }
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)