patch to Throwable.java

Archie Cobbs archie at whistle.com
Mon Aug 17 14:44:07 PDT 1998


This is a minor nit..

When an exception doesn't have a message associated with it,
the java.lang.Throwable.toString() gererates output like
this:

   java/lang/Throwable: null

Here's a patch that fixes this.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com

Index: Throwable.java
===================================================================
RCS file: /cvs/mod/net/kaffe/libraries/javalib/java/lang/Throwable.java,v
retrieving revision 1.1.1.1
diff -c -u -r1.1.1.1 Throwable.java
--- Throwable.java	1998/07/14 16:49:32	1.1.1.1
+++ Throwable.java	1998/08/17 21:43:37
@@ -49,23 +49,13 @@
 
 public void printStackTrace(PrintStream s)
 	{
-	if (message != null) {
-		s.println(this.getClass().getName() + ": " + message);
-	}
-	else {
-		s.println(this.getClass().getName());
-	}
+	s.println(this.toString());
 	printStackTrace0(s);
 }
 
 public void printStackTrace(PrintWriter s)
 	{
-	if (message != null) {
-		s.println(this.getClass().getName() + ": " + message);
-	}
-	else {
-		s.println(this.getClass().getName());
-	}
+	s.println(this.toString());
 	printStackTrace0(s);
 }
 
@@ -73,6 +63,11 @@
 
 public String toString()
 	{
-	return (this.getClass().getName() + ": " + message);
+	if (message != null) {
+		return (this.getClass().getName() + ": " + message);
+	}
+	else {
+		return (this.getClass().getName());
+	}
 }
 }


More information about the kaffe mailing list