You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary D. Gregory (Jira)" <ji...@apache.org> on 2024/11/26 13:24:00 UTC

[jira] [Comment Edited] (IO-865) ThrottledInputStream.Builder does not return builder instance for setMaxBytesPerSecond()

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

Gary D. Gregory edited comment on IO-865 at 11/26/24 1:23 PM:
--------------------------------------------------------------

In 3.0, we can change the return value, until then we need to maintain binary compatibility.

I'll update the docs soon.

Note that the current code says:
{code:java}
        public void setMaxBytesPerSecond(final long maxBytesPerSecond) {
            setMaxBytesPerSecond((double) maxBytesPerSecond);
            // TODO 3.0
            // return asThis();
        }
{code}


was (Author: garydgregory):
In 3.0, we can change the return value, until then we need to maintain binary compatibility.

I'll update the docs soon.


> ThrottledInputStream.Builder does not return builder instance for setMaxBytesPerSecond()
> ----------------------------------------------------------------------------------------
>
>                 Key: IO-865
>                 URL: https://issues.apache.org/jira/browse/IO-865
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 2.18.0
>            Reporter: Nico Strecker
>            Priority: Minor
>
> The ThrottledInputStream documentation contains the following example:
> {code:java}
> ThrottledInputStream in = ThrottledInputStream.builder()
>   .setInputStream(inputStream)
>   .setMaxBytesPerSecond(100_000)
>   .get();{code}
> This example does not work because setMaxBytesPerSecond does not return the builder instance but void:
> {code:java}
> public void setMaxBytesPerSecond(final long maxBytesPerSecond) {
>     this.maxBytesPerSecond = maxBytesPerSecond;
> } {code}
> Either we correct the documentation or we return the builder instance, which I would prefer.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)