Why we are not using common util classes to do these ?

https://commons.apache.org/proper/commons-io/apidocs/org/apache/commons/io/IOUtils.html
On Oct 29, 2015 10:13 AM, "Gayan Gunawardana" <ga...@wso2.com> wrote:

> Hi Kishanthan,
>
> We can simply fix this by putting try catch on close methods. AFAIK stream
> closing shouldn't be done inside this method and it should be done by
> client who invoke the public api. If we remove closing statements now that
> might break existing clients. Please consider this for future releases.
>
> Thanks,
> Gayan
>
> On Tue, Oct 27, 2015 at 9:48 AM, Kishanthan Thangarajah <
> kishant...@wso2.com> wrote:
>
>> You can always fix and send a PR :)
>>
>> On Mon, Oct 26, 2015 at 12:19 PM, Gayan Gunawardana <ga...@wso2.com>
>> wrote:
>>
>>> Hi Kernel Team,
>>>
>>> Referring to location [1] there will be possible code Improvement.
>>>
>>> public static void copyInputStream(InputStream in, OutputStream out)
>>> throws IOException {
>>>     byte[] buf = new byte[BYTE_ARRAY_SIZE];
>>>     int len;
>>>     while ((len = in.read(buf)) > 0) {
>>>         out.write(buf, 0, len);
>>>     }
>>>
>>>    in.close();
>>>    out.close();
>>> }
>>>
>>> If in.close() throws an IOException, out.close() would not be executed.
>>> Can you please look into this ?
>>>
>>> [1]
>>> https://github.com/wso2/carbon-kernel/blob/master/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/utils/IOStreamUtils.java
>>>
>>> Thanks,
>>> Gayan
>>> --
>>> Gayan Gunawardana
>>> Software Engineer; WSO2 Inc.; http://wso2.com/
>>> Email: ga...@wso2.com
>>> Mobile: +94 (71) 8020933
>>>
>>
>>
>>
>> --
>> *Kishanthan Thangarajah*
>> Associate Technical Lead,
>> Platform Technologies Team,
>> WSO2, Inc.
>> lean.enterprise.middleware
>>
>> Mobile - +94773426635
>> Blog - *http://kishanthan.wordpress.com
>> <http://kishanthan.wordpress.com>*
>> Twitter - *http://twitter.com/kishanthan <http://twitter.com/kishanthan>*
>>
>
>
>
> --
> Gayan Gunawardana
> Software Engineer; WSO2 Inc.; http://wso2.com/
> Email: ga...@wso2.com
> Mobile: +94 (71) 8020933
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to