[ 
https://issues.apache.org/jira/browse/IO-714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17292018#comment-17292018
 ] 

Gary D. Gregory edited comment on IO-714 at 9/26/21, 3:30 PM:
--------------------------------------------------------------

IANAL but I see this as:
 * Part of the issue is on whose behalf you would be providing contributions, 
as an individual or as part as a job you are doing for a company.
 * If you care about the legal health of a project and the ASF, you'd sign the 
appropriate paperwork. 
 * Please read [http://www.apache.org/licenses/contributor-agreements.html]
 * I am sure you noticed the use of the word "desires" which you should balance 
with any of your own desires for the health of the ASF.
 * So it's up to you. I don't have any stats as to how many PR contributors 
have a *CLA on file.
 * WRT "simple", well, that's a bit subjective but if you were to provide some 
clever algorithm or a "large" quantity of behavioral changes (as opposed to 
automated source change a la Eclpise clean ups) then someone would suggest that 
a CLA would be appropriate. 

HTH.


was (Author: garydgregory):
IANAL but I see this as:
 * Part of the issue is on whose behalf you would be providing contributions, 
as an individual or as part as a job you are doing for a company.
 * If you care about the legal health of a project and the ASF, you'd sign the 
appropriate paperwork. 
 * Please read [http://www.apache.org/licenses/contributor-agreements.html]
 * I am sure notice the use of the word "desires" which you should balance with 
any of your own desires for the health of the ASF.
 * So it's up to you. I don't have any stats as to how many PR contributors 
have a *CLA on file.
 * WRT "simple", well, that's a bit subjective but if you were to provide some 
clever algorithm or a "large" quantity of behavioral changes (as opposed to 
automated source change a la Eclpise clean ups) then someone would suggest that 
a CLA would be appropriate. 

HTH.

> ReaderInputStream does not call CharsetEncoder.flush(...)
> ---------------------------------------------------------
>
>                 Key: IO-714
>                 URL: https://issues.apache.org/jira/browse/IO-714
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Streams/Writers
>    Affects Versions: 2.8.0
>            Reporter: Marcono1234
>            Priority: Major
>
> As defined by the {{CharsetEncoder}} 
> [documentation|https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/charset/CharsetEncoder.html]
>  the _encoding operation_ consists of:
> # (reset)
> # encode
> # flush
> However, {{org.apache.commons.io.input.ReaderInputStream}} does not call 
> {{flush}}. This leads to incorrect results for charsets whose {{flush}} 
> method appends additional bytes.
> Example:
> {code}
> // Charset whose CharsetEncoder.flush(...) puts bytes
> Charset charset = Charset.forName("Cp930");
> // \u0391: Causes CharsetEncoder.flush(...) to put additional bytes
> String s = "\u0391";
> byte[] expected = s.getBytes(charset);
> byte[] actual;
> try (InputStream in = new ReaderInputStream(new StringReader(s), charset)) {
>     actual = IOUtils.toByteArray(in);
> }
> if (!Arrays.equals(expected, actual)) {
>     throw new AssertionError("\n  Expected: " + Arrays.toString(expected) + 
> "\n  Actual:   " + Arrays.toString(actual));
> }
> {code}
> Also make sure to check the result of {{flush()}} because {{OVERFLOW}} as 
> result is possible. In theory {{isError() == true}} might be possible as 
> well, but I don't think any of charset implementations currently return that.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to