Patch: FYI: ThreadGroup print

Tom Tromey tromey@redhat.com
Wed Oct 24 00:41:00 GMT 2001


ThreadGroup.uncaughtException was printing some text to stdout.
It ought to print to stderr.  I'm checking this in.
It also went into Classpath.

I'd prefer to change the first print to a println, because I think
that makes the output read better, but apparently it was written this
way for compatibility with the JDK.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/ThreadGroup.java (uncaughtException): Print message to
	System.err.  Required by spec.

Index: java/lang/ThreadGroup.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/ThreadGroup.java,v
retrieving revision 1.13
diff -u -r1.13 ThreadGroup.java
--- java/lang/ThreadGroup.java 2001/03/12 07:40:17 1.13
+++ java/lang/ThreadGroup.java 2001/12/07 23:30:07
@@ -510,17 +510,18 @@
     else if (! (t instanceof ThreadDeath))
       {
         if (thread != null)
-          System.out.print("Exception in thread \"" + thread.getName() + "\" ");
+          System.err.print ("Exception in thread \""
+			    + thread.getName() + "\" ");
 	try
 	  {
-	    t.printStackTrace();
+	    t.printStackTrace(System.err);
 	  }
 	catch (Throwable x)
 	  {
 	    // This means that something is badly screwed up with the runtime,
 	    // or perhaps someone is messing with the SecurityManager. In any
 	    // case, try to deal with it gracefully.
-	    System.out.println(t);
+	    System.err.println(t);
 	    System.err.println("*** Got " + x.toString() + 
 			       " while trying to print stack trace");
 	  }



More information about the Java-patches mailing list