* Matthew Toseland <toad at amphibian.dyndns.org> [2008-08-22 14:28:11]:

> On Sunday 17 August 2008 19:31, nextgens at freenetproject.org wrote:
> > Author: nextgens
> > Date: 2008-08-17 18:31:15 +0000 (Sun, 17 Aug 2008)
> > New Revision: 21977
> > 
> > Modified:
> >    trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
> > Log:
> > bug #2501: maybe fix the issue for real
> > 
> > Modified: trunk/freenet/src/freenet/support/io/LineReadingInputStream.java
> > ===================================================================
> > --- trunk/freenet/src/freenet/support/io/LineReadingInputStream.java        
> 2008-08-17 18:24:10 UTC (rev 21976)
> > +++ trunk/freenet/src/freenet/support/io/LineReadingInputStream.java        
> 2008-08-17 18:31:15 UTC (rev 21977)
> > @@ -33,11 +33,10 @@
> >             
> >             byte[] buf = new byte[Math.max(Math.min(128, maxLength), 
> > Math.min(1024, 
> bufferSize))];
> >             int ctr = 0;
> > -           mark((maxLength+1)*2); // Might be more than maxLengh if we use 
> > utf8
> > +           mark(Integer.MAX_VALUE); // Might be more than maxLengh if we 
> > use utf8
> 
> How can it EVER be more than maxLength + 2 ? (\r\n) All these parameters are 
> in bytes afaics.

Some utf8 chars up to 4 bytes.

> Some impl's are surely going to throw if you do mark(Integer.MAX_VALUE).
> 

Which implementations are you talking about? why wouldn't
Integer.MAX_VALUE be valid?

> Do we ever reset the mark? How do you reset the mark? AFAICS if you don't it 
> will cause it to keep on buffering forever and then OOM, no?

We don't need to reset the mark; we throw if it's > maxlength
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: 
<https://emu.freenetproject.org/pipermail/devl/attachments/20080822/4b012a74/attachment.pgp>

Reply via email to