[jdom-interest] cvs.jdom.org is down. When will it be back

Bradley S. Huffman hip at a.cs.okstate.edu
Fri Dec 20 20:09:02 PST 2002


Malachi de AElfweald writes:

> I'm curious... I have seen many references to the "StringBuffer error".... 
> but,
> I have not yet experienced anything... what exactly is this bug?

As I recall it was using StringBuffer as a reusable buffer. As in

    StringBuffer buffer = new StringBuffer(1024);

    // store stuff in buffer

   String a = buffer.toString();
   buffer.setLength(0);

Now if you reuse the buffer, thinking you still have 1024 char allocated,
you'd be wrong. Either toString or setLength reallocates StringBuffers
internal array to it's default size (which at think is 16).

Brad



More information about the jdom-interest mailing list