[Webfunds-commits] java/webfunds/utils Debug.java

Ian Grigg iang@cypherpunks.ai
Sat, 14 Apr 2001 17:31:22 -0400 (AST)


iang        01/04/14 17:31:22

  Modified:    webfunds/utils Debug.java
  Log:
  oops, stacktrace(err()) panics on wrong Object, needs to return PW

Revision  Changes    Path
1.12      +10 -5     java/webfunds/utils/Debug.java

Index: Debug.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/utils/Debug.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Debug.java	2001/04/12 04:43:28	1.11
+++ Debug.java	2001/04/14 21:31:21	1.12
@@ -1,5 +1,5 @@
 /*
- * $Id: Debug.java,v 1.11 2001/04/12 04:43:28 iang Exp $
+ * $Id: Debug.java,v 1.12 2001/04/14 21:31:21 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -96,13 +96,18 @@
     public Log         getLog()           { return (Log)bug; }
                 
     /**
-     * Do stack trace prints to err().
+     * Do stack trace prints to err().  Stack traces need a PW.
      */
     public PrintWriter err()
     {   
-        if (bug == null)
-            return new PrintWriter(System.err, true) ;
+        PrintWriter pw;
+        if (bug instanceof Log)
+            pw = new PrintWriter(bug, true);
+        else if (bug == null)
+            pw = new PrintWriter(System.err, true) ;
         else
-            return bug ;
+            pw = bug;
+
+        return pw;
     }
 }