You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Leif Mortenson <le...@silveregg.co.jp> on 2002/02/22 07:36:36 UTC

Framework CascadingException.printStackTrace does not show the nested cause.

I noticed that the CascadingException class does not currently print out
the stack
trace of the nested cause along with the stack trace of the
CascadingException.
It seems like it would be a lot more useful if it did. I am including
the patch and
can submit it if there are no objections, but I wanted to make sure that
there
wasn't a reason why this shouldn't be done first.

Cheers,
Leif

RCS file:
/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/CascadingException.java,v
retrieving revision 1.3
diff -r1.3 CascadingException.java
9a10,12
> import java.io.PrintStream;
> import java.io.PrintWriter;
>
51a55,72
> }
>
> public final void printStackTrace()
> {
> super.printStackTrace();
> System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
> }
>
> public final void printStackTrace( PrintStream stream )
> {
> super.printStackTrace( stream );
> stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
> }
>
> public final void printStackTrace( PrintWriter writer )
> {
> super.printStackTrace( writer );
> writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Framework CascadingException.printStackTrace does not show the nested cause.

Posted by Peter Donald <pe...@apache.org>.
On Fri, 22 Feb 2002 17:36, Leif Mortenson wrote:
> I noticed that the CascadingException class does not currently print out
> the stack
> trace of the nested cause along with the stack trace of the
> CascadingException.
> It seems like it would be a lot more useful if it did. I am including
> the patch and
> can submit it if there are no objections, but I wanted to make sure that
> there
> wasn't a reason why this shouldn't be done first.

It was by design that it behaved like that :) Mainly because I often only 
wanted to display parts of each stack trace rather than full stack traces all 
the time.

-- 
Cheers,

Pete

*------------------------------------------------------*
| "Common sense is the collection of prejudices        |
|  acquired by age 18. " -Albert Einstein              |
*------------------------------------------------------*

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Framework CascadingException.printStackTrace does not show the nested cause.

Posted by Leif Mortenson <le...@silveregg.co.jp>.
I had actually posted that before understanding all of the code. It was
done that way by
design to avoid having the full stack dumps printed out. In most cases,
the final exception
should be giving you the necessary information to fix the problem. Where
it does not,
that should be changed.

The ExceptionUtil class is useful as a public class because it lets
other classes handle the
CascadingThrowables however they like. The Avalon Log Formatter for
example will print
out the full stack trace along with the stack traces of the exception
which caused it.

Cheers,
Leif

Eung-ju Park wrote:

>How about
>
>1. Make ExceptionUtil to private class.
>2. Use it in CascadingException, CascadingError and
>CascadingRuntimeException.
>3. Remove all reference to ExceptionUtil.
>
>Thoughts?
>
>----- Original Message -----
>From: "Leif Mortenson" <le...@silveregg.co.jp>
>To: "Avalon Dev Mailing List" <av...@jakarta.apache.org>
>Sent: Friday, February 22, 2002 3:36 PM
>Subject: Framework CascadingException.printStackTrace does not show the
>nested cause.
>
>
>>I noticed that the CascadingException class does not currently print out
>>the stack
>>trace of the nested cause along with the stack trace of the
>>CascadingException.
>>It seems like it would be a lot more useful if it did. I am including
>>the patch and
>>can submit it if there are no objections, but I wanted to make sure that
>>there
>>wasn't a reason why this shouldn't be done first.
>>
>>Cheers,
>>Leif
>>
>>RCS file:
>>
>/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/CascadingExcep
>tion.java,v
>
>>retrieving revision 1.3
>>diff -r1.3 CascadingException.java
>>9a10,12
>>
>>>import java.io.PrintStream;
>>>import java.io.PrintWriter;
>>>
>>51a55,72
>>
>>>}
>>>
>>>public final void printStackTrace()
>>>{
>>>super.printStackTrace();
>>>System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8,
>>>
>true ) );
>
>>>}
>>>
>>>public final void printStackTrace( PrintStream stream )
>>>{
>>>super.printStackTrace( stream );
>>>stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>>>}
>>>
>>>public final void printStackTrace( PrintWriter writer )
>>>{
>>>super.printStackTrace( writer );
>>>writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>>>
>>
>>
>>--
>>To unsubscribe, e-mail:
>>
><ma...@jakarta.apache.org>
>
>>For additional commands, e-mail:
>>
><ma...@jakarta.apache.org>
>
>>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Framework CascadingException.printStackTrace does not show the nested cause.

Posted by Eung-ju Park <co...@apache.org>.
How about

1. Make ExceptionUtil to private class.
2. Use it in CascadingException, CascadingError and
CascadingRuntimeException.
3. Remove all reference to ExceptionUtil.

Thoughts?

----- Original Message -----
From: "Leif Mortenson" <le...@silveregg.co.jp>
To: "Avalon Dev Mailing List" <av...@jakarta.apache.org>
Sent: Friday, February 22, 2002 3:36 PM
Subject: Framework CascadingException.printStackTrace does not show the
nested cause.


> I noticed that the CascadingException class does not currently print out
> the stack
> trace of the nested cause along with the stack trace of the
> CascadingException.
> It seems like it would be a lot more useful if it did. I am including
> the patch and
> can submit it if there are no objections, but I wanted to make sure that
> there
> wasn't a reason why this shouldn't be done first.
>
> Cheers,
> Leif
>
> RCS file:
>
/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/CascadingExcep
tion.java,v
> retrieving revision 1.3
> diff -r1.3 CascadingException.java
> 9a10,12
> > import java.io.PrintStream;
> > import java.io.PrintWriter;
> >
> 51a55,72
> > }
> >
> > public final void printStackTrace()
> > {
> > super.printStackTrace();
> > System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8,
true ) );
> > }
> >
> > public final void printStackTrace( PrintStream stream )
> > {
> > super.printStackTrace( stream );
> > stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
> > }
> >
> > public final void printStackTrace( PrintWriter writer )
> > {
> > super.printStackTrace( writer );
> > writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Framework CascadingException.printStackTrace does not show the nested cause.

Posted by Leif Mortenson <le...@silveregg.co.jp>.
It looks like this is actually not needed or desired. The problem was
that I was using the
ExtendedPaternFormatter which does not support CascadingExceptions. I
really should
have been using the AvalonFormatter.

Leif

Leif Mortenson wrote:

>I noticed that the CascadingException class does not currently print out
>the stack
>trace of the nested cause along with the stack trace of the
>CascadingException.
>It seems like it would be a lot more useful if it did. I am including
>the patch and
>can submit it if there are no objections, but I wanted to make sure that
>there
>wasn't a reason why this shouldn't be done first.
>
>Cheers,
>Leif
>
>RCS file:
>/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/CascadingException.java,v
>retrieving revision 1.3
>diff -r1.3 CascadingException.java
>9a10,12
>
>>import java.io.PrintStream;
>>import java.io.PrintWriter;
>>
>51a55,72
>
>>}
>>
>>public final void printStackTrace()
>>{
>>super.printStackTrace();
>>System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>>}
>>
>>public final void printStackTrace( PrintStream stream )
>>{
>>super.printStackTrace( stream );
>>stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>>}
>>
>>public final void printStackTrace( PrintWriter writer )
>>{
>>super.printStackTrace( writer );
>>writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>>
>
>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Framework CascadingException.printStackTrace does not show the nested cause.

Posted by Eung-ju Park <co...@apache.org>.
CascadingRuntimeException and CascadingError needs same thing.
But it is unnecessary duplicated code.
Just use ExceptionUtil is not bad....

----- Original Message -----
From: "Leif Mortenson" <le...@silveregg.co.jp>
To: "Avalon Dev Mailing List" <av...@jakarta.apache.org>
Sent: Friday, February 22, 2002 3:36 PM
Subject: Framework CascadingException.printStackTrace does not show the
nested cause.


> I noticed that the CascadingException class does not currently print out
> the stack
> trace of the nested cause along with the stack trace of the
> CascadingException.
> It seems like it would be a lot more useful if it did. I am including
> the patch and
> can submit it if there are no objections, but I wanted to make sure that
> there
> wasn't a reason why this shouldn't be done first.
>
> Cheers,
> Leif
>
> RCS file:
>
/home/cvs/jakarta-avalon/src/java/org/apache/avalon/framework/CascadingExcep
tion.java,v
> retrieving revision 1.3
> diff -r1.3 CascadingException.java
> 9a10,12
> > import java.io.PrintStream;
> > import java.io.PrintWriter;
> >
> 51a55,72
> > }
> >
> > public final void printStackTrace()
> > {
> > super.printStackTrace();
> > System.out.print( ExceptionUtil.printStackTrace( m_throwable, 8,
true ) );
> > }
> >
> > public final void printStackTrace( PrintStream stream )
> > {
> > super.printStackTrace( stream );
> > stream.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
> > }
> >
> > public final void printStackTrace( PrintWriter writer )
> > {
> > super.printStackTrace( writer );
> > writer.print( ExceptionUtil.printStackTrace( m_throwable, 8, true ) );
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>