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
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to