This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug in call-with-output-string ?


I've had sporadic failures when calling format, which as far as I
remember, generated a very similar error message, tracing backwards from a
call of outputPartialLine. Haven't managed to isolate the cause, but since
the data structures I'm using ought to be the same shape on all my calls
to 'format', some of which fail and others don't), it seemed likely that
some string or buffer was becoming too long.

Unfortunately, not having yet had time to put aside to diagnose the
problem, my response has been to stop using 'format'. But it looks as
though it could be a similar cause to that discussed here.

Jocelyn Paine

On Sun, 30 Sep 2001, Jim White wrote:

> At 04:55 PM 9/30/2001 -0700, kamysh@uroam.com wrote:
> >it seems, there is a bug in realization of `call-with-output-string' in
> >kawa-1.6.94: it does not allow more than 126 symbols to be `displayed.
> >...
> 
> Wow.  Tough looking problem.  I tracked it down to this:
> 
> 1) PrettWriter.java:41:
>    public static int initialBufferSize = 126;
> 
> 2) PrettyWriter.ensureSpaceInBuffer:717
>    Sees that the buffer is full when the 127th character is to be output,
>    and so calls outputPartialLine().
> 
> 3) PrettyWriter.outputPartialLine expects PrettyWriter.out to be non-null 
> so that it can output the line as collected so far.
> 
> But!
> 
> 4) gnu.mapping.CharArrayOutPort is an OutPort whose OutPort.base Writer is 
> null, which is what it ends up giving to PrettyWriter:
>      super(null, false, "<string>");
> 
> The fix looks fairly simple (CharArrayOutPort needs to give OutPort a 
> CharArrayWriter to write onto).
> 
> Attached is an untested (or even compiled) rewrite of 
> kawa.standard.call_with_output_string.  It is based on 
> call_with_output_file (which should work and you might want use instead of 
> _with_string as a workaround).
> 
> That is only a hack as it doesn't fix CharArrayOutPort which is used by 
> gnu.kawa.functions.Format.formatToString.
> 
> jim
> 
> ----------------------------------------------------------------
> James P. White                 Netscape DevEdge Champion for IFC
> IFC Exchange   *   Insanely great Java   *   http://www.ifcx.org
> jim@pagesmiths.com Pagesmiths' home is http://www.pagesmiths.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]