[patch] fix for PR java.io/50

Tom Tromey tromey@cygnus.com
Sun Oct 31 07:42:00 GMT 1999


>>>>> "Bryce" == Bryce McKinlay <bryce@albatross.co.nz> writes:

Bryce> Here's a patch to fix those. OK to commit, Tom?

Almost.

Bryce> Index: libjava/java/io/PrintStream.java
Bryce> ===================================================================
Bryce> RCS file: /cvs/java/libgcj/libjava/java/io/PrintStream.java,v
Bryce> retrieving revision 1.6
Bryce> diff -u -r1.6 PrintStream.java
Bryce> --- PrintStream.java	1999/09/21 21:35:41	1.6
Bryce> +++ PrintStream.java	1999/10/31 08:02:47
Bryce> @@ -238,9 +238,11 @@
 
Bryce>    public PrintStream (OutputStream out, boolean af)
Bryce>    {
Bryce> -    super ((this.out = (out instanceof BufferedOutputStream
Bryce> -			 ? (BufferedOutputStream) out
Bryce> -			 : new BufferedOutputStream(out, 250))));
Bryce> +    super(out);
Bryce> +    this.out = out instanceof BufferedOutputStream
Bryce> +	       ? (BufferedOutputStream) out
Bryce> +	       : new BufferedOutputStream(out, 250);
Bryce> +
Bryce>      converter = UnicodeToBytes.getDefaultEncoder();
Bryce>      error = false;
Bryce>      auto_flush = af;

This actually changes the behavior.
Both PrintStream and FilterOutputStream have instance variables named
"out" (weird, but there it is).  This doesn't set them to the same
value any more.

Set "super.out", and add a comment explaining why we do this weird
thing (in each of the patched constructors), and this is fine.

Thanks,
Tom


More information about the Java-patches mailing list