User: user57  
  Date: 02/04/18 23:56:26

  Modified:    src/main/org/jboss/util AbstractNestedThrowable.java
                        NestedError.java NestedException.java
                        NestedRuntimeException.java NestedThrowable.java
  Log:
   o fixed nested exception stack printing, such that outermost throwable
     trace prints first, then nested
   o revised throwable message to better show nested seperation
  
  Revision  Changes    Path
  1.3       +3 -3      
jboss-common/src/main/org/jboss/util/AbstractNestedThrowable.java
  
  Index: AbstractNestedThrowable.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-common/src/main/org/jboss/util/AbstractNestedThrowable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractNestedThrowable.java      17 Feb 2002 03:47:52 -0000      1.2
  +++ AbstractNestedThrowable.java      19 Apr 2002 06:56:25 -0000      1.3
  @@ -16,7 +16,7 @@
    * A common superclass for <tt>Throwable</tt> classes that can contain
    * a nested <tt>Throwable</tt> detail object.
    *
  - * @version <tt>$Revision: 1.2 $</tt>
  + * @version <tt>$Revision: 1.3 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public abstract class AbstractNestedThrowable
  @@ -103,8 +103,8 @@
       * @param stream  Stream to print to.
       */
      public void printStackTrace(final PrintStream stream) {
  -      NestedThrowable.Util.print(this, stream);
         super.printStackTrace(stream);
  +      NestedThrowable.Util.print(nested, stream);
      }
   
      /**
  @@ -114,8 +114,8 @@
       * @param writer  Writer to print to.
       */
      public void printStackTrace(final PrintWriter writer) {
  -      NestedThrowable.Util.print(this, writer);
         super.printStackTrace(writer);
  +      NestedThrowable.Util.print(nested, writer);
      }
   
      /**
  
  
  
  1.3       +3 -3      jboss-common/src/main/org/jboss/util/NestedError.java
  
  Index: NestedError.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-common/src/main/org/jboss/util/NestedError.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NestedError.java  17 Feb 2002 03:47:52 -0000      1.2
  +++ NestedError.java  19 Apr 2002 06:56:25 -0000      1.3
  @@ -16,7 +16,7 @@
    * A common superclass for <tt>Error</tt> classes that can
    * contain a nested <tt>Throwable</tt> detail object.
    *
  - * @version <tt>$Revision: 1.2 $</tt>
  + * @version <tt>$Revision: 1.3 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public class NestedError
  @@ -103,8 +103,8 @@
       * @param stream  Stream to print to.
       */
      public void printStackTrace(final PrintStream stream) {
  -      NestedThrowable.Util.print(this, stream);
         super.printStackTrace(stream);
  +      NestedThrowable.Util.print(nested, stream);
      }
   
      /**
  @@ -114,8 +114,8 @@
       * @param writer  Writer to print to.
       */
      public void printStackTrace(final PrintWriter writer) {
  -      NestedThrowable.Util.print(this, writer);
         super.printStackTrace(writer);
  +      NestedThrowable.Util.print(nested, writer);
      }
   
      /**
  
  
  
  1.3       +3 -3      jboss-common/src/main/org/jboss/util/NestedException.java
  
  Index: NestedException.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-common/src/main/org/jboss/util/NestedException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NestedException.java      17 Feb 2002 03:47:52 -0000      1.2
  +++ NestedException.java      19 Apr 2002 06:56:25 -0000      1.3
  @@ -16,7 +16,7 @@
    * A common superclass for <tt>Exception</tt> classes that can contain
    * a nested <tt>Throwable</tt> detail object.
    *
  - * @version <tt>$Revision: 1.2 $</tt>
  + * @version <tt>$Revision: 1.3 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public class NestedException
  @@ -103,8 +103,8 @@
       * @param stream  Stream to print to.
       */
      public void printStackTrace(final PrintStream stream) {
  -      NestedThrowable.Util.print(this, stream);
         super.printStackTrace(stream);
  +      NestedThrowable.Util.print(nested, stream);
      }
   
      /**
  @@ -114,8 +114,8 @@
       * @param writer  Writer to print to.
       */
      public void printStackTrace(final PrintWriter writer) {
  -      NestedThrowable.Util.print(this, writer);
         super.printStackTrace(writer);
  +      NestedThrowable.Util.print(nested, writer);
      }
   
      /**
  
  
  
  1.3       +3 -3      jboss-common/src/main/org/jboss/util/NestedRuntimeException.java
  
  Index: NestedRuntimeException.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss-common/src/main/org/jboss/util/NestedRuntimeException.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NestedRuntimeException.java       17 Feb 2002 03:47:52 -0000      1.2
  +++ NestedRuntimeException.java       19 Apr 2002 06:56:25 -0000      1.3
  @@ -16,7 +16,7 @@
    * A common superclass for <tt>RuntimeException</tt> classes that can
    * contain a nested <tt>Throwable</tt> detail object.
    *
  - * @version <tt>$Revision: 1.2 $</tt>
  + * @version <tt>$Revision: 1.3 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public class NestedRuntimeException
  @@ -103,8 +103,8 @@
       * @param stream  Stream to print to.
       */
      public void printStackTrace(final PrintStream stream) {
  -      NestedThrowable.Util.print(this, stream);
         super.printStackTrace(stream);
  +      NestedThrowable.Util.print(nested, stream);
      }
   
      /**
  @@ -114,8 +114,8 @@
       * @param writer  Writer to print to.
       */
      public void printStackTrace(final PrintWriter writer) {
  -      NestedThrowable.Util.print(this, writer);
         super.printStackTrace(writer);
  +      NestedThrowable.Util.print(nested, writer);
      }
   
      /**
  
  
  
  1.3       +17 -30    jboss-common/src/main/org/jboss/util/NestedThrowable.java
  
  Index: NestedThrowable.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-common/src/main/org/jboss/util/NestedThrowable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NestedThrowable.java      17 Feb 2002 03:47:52 -0000      1.2
  +++ NestedThrowable.java      19 Apr 2002 06:56:25 -0000      1.3
  @@ -16,7 +16,7 @@
   /**
    * Interface which is implemented by all the nested throwable flavors.
    *
  - * @version <tt>$Revision: 1.2 $</tt>
  + * @version <tt>$Revision: 1.3 $</tt>
    * @author  <a href="mailto:[EMAIL PROTECTED]";>Jason Dillon</a>
    */
   public interface NestedThrowable
  @@ -47,8 +47,8 @@
       * Utilitiy methods for the various flavors of
       * <code>NestedThrowable</code>.
       */
  -   final class Util {
  -
  +   final class Util 
  +   {
         /**
          * Returns a formated message for the given detail message
          * and nested <code>Throwable</code>.
  @@ -64,8 +64,9 @@
   
            if (nested != null) {
               buff.append(msg == null ? "- " : "; - ")
  -               .append("nested throwable is: ")
  -               .append(nested);
  +               .append("nested throwable: (")
  +               .append(nested)
  +               .append(")");
            }
    
            return buff.toString();
  @@ -74,53 +75,39 @@
         /**
          * Prints the nested <code>Throwable</code> to the given stream.
          *
  -       * @param t       <code>NestedThrowable</code> to get nested from.
  +       * @param nested  Nested <code>Throwable</code>.
          * @param stream  Stream to print to.
          */
  -      public static void print(final NestedThrowable t,
  +      public static void print(final Throwable nested,
                                  final PrintStream stream)
         {
  -         if (t == null)
  -            throw new NullArgumentException("t");
  -
  -         Throwable nested = t.getNested();
  +         if (stream == null)
  +            throw new NullArgumentException("stream");
   
            if (nested != null) {
  -            if (stream == null)
  -               throw new NullArgumentException("stream");
  -
               synchronized (stream) {
  -               stream.println(t);
                  stream.print(" + nested throwable: ");
  -               nested.printStackTrace(stream);
  -               stream.print(" + throwable: ");
  +               nested.printStackTrace();
               }
            }
         }
   
         /**
  -       * Prints the nested <code>Throwable</code> to the given stream.
  +       * Prints the nested <code>Throwable</code> to the given writer.
          *
  -       * @param t       <code>NestedThrowable</code> to get nested from.
  +       * @param nested  Nested <code>Throwable</code>.
          * @param writer  Writer to print to.
          */
  -      public static void print(final NestedThrowable t,
  +      public static void print(final Throwable nested,
                                  final PrintWriter writer)
         {
  -         if (t == null)
  -            throw new NullArgumentException("t");
  -
  -         Throwable nested = t.getNested();
  +         if (writer == null)
  +            throw new NullArgumentException("writer");
   
            if (nested != null) {
  -            if (writer == null)
  -               throw new NullArgumentException("writer");
  -
               synchronized (writer) {
  -               writer.println(t);
                  writer.print(" + nested throwable: ");
  -               nested.printStackTrace(writer);
  -               writer.print(" + throwable: ");
  +               nested.printStackTrace();
               }
            }
         }
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to