[kaffe] System.setOut not working

Daniel Bonniot Daniel.Bonniot at inria.fr
Sun Mar 27 06:47:29 PST 2005


Hi,

Here is a simple testcase to exercise System.setOut. It looks as if System.out 
is not changed at all in kaffe.

import java.io.*;

public class Kaffe
{
   public static void main(String[] args)
   {
     OutputStream stream = new ByteArrayOutputStream();
     PrintStream out = new PrintStream(stream);
     PrintStream origOut = System.out;
     System.setOut(out);
     try {
       try {
	System.out.println("IN");
	throw new Error();
       }
       finally {
	System.setOut(origOut);
	try {
	  stream.close();
	  out.close();
	} catch(IOException e) {
	  e.printStackTrace();
	}
       }
     }
     catch (Error e) {
       System.out.println("CATCH");
     }
     System.out.println("OUT");
   }
}


$ java Kaffe
CATCH
OUT

$ kaffe Kaffe
IN
CATCH
OUT


Daniel





More information about the kaffe mailing list