Re: [PATCH] CipherStream produces new byte array on every update or doFinal operation

2015-02-17 Thread Dai Nakanishi
Thank you for your review. My apologies for sending an inappropriate request. Cipher should not throw the ShortBufferException because the buffer is enlarged before update() or doFinal(). The enlarged size is based on the result of getOutputSize(). Even if I use the destination buffer, CipherInpu

Re: [PATCH] CipherStream produces new byte array on every update or doFinal operation

2015-02-17 Thread Florian Weimer
On 02/17/2015 01:53 PM, Dai Nakanishi wrote: > +} catch (ShortBufferException e) { > +obuffer = null; > +throw new IOException(e); > } This doesn't look right to me. You need to enlarge the buffer and retry. If you really want to avoid allocations, you sh

[PATCH] CipherStream produces new byte array on every update or doFinal operation

2015-02-17 Thread Dai Nakanishi
Hi, CipherInputStream and CipherOutputStream call the Cipher methods update and doFinal which produce new byte array. It may consume a large amount of memory. The purpose of my patch is to avoid this. Could you review the patch? Thanks, Dai --- old/src/share/classes/javax/crypto/CipherInputStre