System.err peculiarity

Godmar Back gback at cs.utah.edu
Wed Jul 15 11:49:54 PDT 1998


 Archie,

> 
> Try the patch below and see if it helps. IMHO this (or equivalent)
> should be committed.
> 

 The "true" means autoflush; which achieves the desired
behavior.  If it doesn't work, we need to investigate and fix the
behavior of PrintStream/Writer autoflush, not dynamically create
an inner class for System.err

	- Godmar


> -Archie
> 
> ___________________________________________________________________________
> Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com
> 
> Index: libraries/javalib/java/lang/System.java
> ===================================================================
> RCS file: /cvs/mod/net/kaffe/libraries/javalib/java/lang/System.java,v
> retrieving revision 1.1.1.1
> diff -c -u -r1.1.1.1 System.java
> --- System.java	1998/07/14 16:49:32	1.1.1.1
> +++ System.java	1998/07/15 18:42:50
> @@ -17,6 +17,7 @@
>  import java.io.FileOutputStream;
>  import java.io.InputStream;
>  import java.io.PrintStream;
> +import java.io.IOException;
>  import java.util.GregorianCalendar;
>  import java.util.SimpleTimeZone;
>  import java.util.Properties;
> @@ -40,7 +41,20 @@
>  	// Setup I/O
>  	setIn(new BufferedInputStream(new FileInputStream(FileDescriptor.in), 128));
>  	setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.out), 128), true));
> -	setErr(new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err), 128), true));
> +	setErr(new PrintStream(new BufferedOutputStream(new FileOutputStream(FileDescriptor.err), 128)
> +
> +	{
> +	  public void write(byte[] ary, int off, int len) throws IOException {
> +	    super.write(ary, off, len);
> +	    this.flush();
> +	  }
> +	  public void write(byte b) throws IOException {
> +	    super.write(b);
> +	    this.flush();
> +	  }
> +	}
> +
> +	, true));
>  
>  	// Initiate the timezone & calendar.
>  	new SimpleTimeZone(0, "GMT");
> 



More information about the kaffe mailing list