This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

OutputStreamWriter flush patch


Hi Tom,

On Thu, 2006-07-20 at 17:46 -0600, Tom Tromey wrote:
> Mark> Unfortunately that didn't work. I haven't debugged it yet, but attached
> Mark> is a small testcase that shows a NullPointerException which it shouldn't
> Mark> give. This might be something subtle gone wrong in the merge since
> Mark> OutputStreamWriter is an override in libgcj. (Note the name of the
> Mark> testcase is misleading it has nothing to do with the Charset used.)
> 
> This fails on trunk.  That's annoying since I "fixed" a bug in this
> code recently.  I guess I over-fixed it back into brokenness.

OK, I see what you fixed. In flush() you want to make sure that
wrieChars() is always called so any encoders are also flushed. But the
work scratch area might still be null. This patch just makes sure that
it exists like in other places were it is used. This makes gcjwebplugin
work nicely.

2006-07-21  Mark Wielaard  <mark@klomp.org>

        * java/io/OutputStreamWriter.java (flush): Create work if null.

OK?

Cheers,

Mark

--- java/io/OutputStreamWriter.java     (revision 115595)
+++ java/io/OutputStreamWriter.java     (working copy)
@@ -203,6 +203,8 @@

        // Always write -- if we are close()ing then we want to make
        // sure the converter is flushed.
+       if (work == null)
+         work = new char[100];
        writeChars(work, 0, wcount);
        wcount = 0;




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