On 11/14/07, Spark Shen <[EMAIL PROTECTED]> wrote:
<SNIP>
>
> I checked your fix, and seems my second point did not convinced you. :-)
Quite opposite :-)
I think the issues you reported are different so I'm going to do separate fixes.
> 2. In method readContent, the if statement:
>
> if (in.read(buffer, offset, length) != length) {
> throw new ASN1Exception(Messages.getString("security.13C"));
> //$NON-NLS-1$
> }
> offset += length;
> is not enough to guarantee all the bytes are read into buffer. This can be
> fixed using a while loop:
>
> int numread = 0, oldoffset = offset;
> while ((numread = in.read(buffer, offset, length)) > 0) {
> offset += numread;
> length -= numread;
> if(length == 0) {
> break;
> }
> }
> length = offset - oldoffset;
> When decoding input from an inputStream retrieved from socket, the if
> statement here is not adequate
> to guarantee all the response bytes from server been collected.
>
> I doubt the off-line reproducer can unveal this bug. Correct if I am wrong.
>
I got the idea and going to try to create off-line reproducer by
implementing custom InputStream.
Thanks,
Stepan.
<SNIP>