classpath-inetlib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpath-inetlib] [PATCH] inetlib bugs


From: Chris Burdess
Subject: Re: [Classpath-inetlib] [PATCH] inetlib bugs
Date: Tue, 24 Jan 2006 18:43:57 +0000
User-agent: Mutt/1.5.10i

Székelyi Szabolcs wrote:
> I've discovered some bugs in inetlib.
> 
> The first fixes the "mark" bug in CRLFInputStream. The readLine() method
> of LineInputStream relies on the underlying input stream ("in") not
> being mark()ed before reset()ting it so reset() rewinds the stream to
> the last marked position. But CRLFInputStream marks the same stream so
> LineInputStream rewinds to the position marked by CRLFInputStream, not
> its own mark.
> 
> This patch makes CRLFInputStream to use some sort of "faking" technique
> instead of marking the stream so LineInputStream works correctly.

This sounds as if the problem is really in LineInputStream. Shouldn't it
be fixed there?

I can't really see what the problem is - the underlying stream always gets
reset to the correct position, doesn't it? Is there a problem with the
internal state of LineInputStream after a reset()?

I am very wary of making changes to CRLFInputStream as it is used
virtually everywhere. I have done some pretty heavy lifting with it in
Classpath, so I feel it's probably correct.

> The second patch is against MessageInputStream. The bug is here that the
> eof flag is not reset when the stream is reset so reading past EOF,
> resetting the stream and reading again gives EOF instead of the stream
> content right after the mark.

The second part of this patch is correct, we should reset eof during reset().
But in the first case eof will already have been set by the call to read(),
won't it?
-- 
Chris Burdess
  "They that can give up essential liberty to obtain a little safety
  deserve neither liberty nor safety." - Benjamin Franklin

Attachment: pgpymQe6IoCQ9.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]