2007/11/15, Stepan Mishura <[EMAIL PROTECTED]>:
>
> On 11/14/07, Stepan Mishura <[EMAIL PROTECTED]> wrote:
> <SNIP>
> > > 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.
>
> Spark,
>
> Does the test below model correctly your case?
>
> byte[] encoding = { 0x04, 0x0F, 0x01, 0x02,
> 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
> 0x0C,
> 0x0D, 0x0E, 0x0F };
>
> // custom input stream that doesn't return all data at once
> ByteArrayInputStream in = new ByteArrayInputStream(encoding) {
> public int read(byte[] b, int off, int len) {
> if (len < 2) {
> return super.read(b, off, len);
> } else {
> return super.read(b, off, len - 1);
> }
>
> }
> };
>
> BerInputStream berIn = new BerInputStream(in);
> berIn.readContent();
Oh, Yes, I think so.
Thanks,
> Stepan.
>
--
Spark Shen
China Software Development Lab, IBM