You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "BELUGA BEHR (JIRA)" <ji...@apache.org> on 2015/03/17 01:55:38 UTC

[jira] [Created] (EXEC-92) StreamPumper - Check For EOF

BELUGA BEHR created EXEC-92:
-------------------------------

             Summary: StreamPumper - Check For EOF
                 Key: EXEC-92
                 URL: https://issues.apache.org/jira/browse/EXEC-92
             Project: Commons Exec
          Issue Type: Bug
    Affects Versions: 1.3
            Reporter: BELUGA BEHR
             Fix For: 1.4
         Attachments: StreamPumper.java.patch

When the StreamPumper is copying data from the InputStream to the OutputStream, it would be safer to check for EOF instead of a read size greater than zero to protect against InputStream implementations that don't respect the contract as defined in Java core JavaDoc.

Patch Included.  I took code from the copy method of the IOUtils class.

{{
            while ((length = is.read(buf)) > 0) {
                os.write(buf, 0, length);
            }
}}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)