avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Hammant <paul_hamm...@yahoo.com>
Subject Re: Alrrmi: ExceptionReply - lack of a stack trace.
Date Mon, 29 Apr 2002 20:32:39 GMT
> >Another technique that I've seen is to capture the stack trace to a string on 
> >the server and then serialize the string. There was some code I found to do 
> >that (it actually broke the stacktrace up into classes) but I can't find it 
> >atm via google.
> >
> I was thinking about this some more.  I have a suggested solution, but 
> it is a bit "hacky".. :-/
> Server side:
> 1) serialize the Throwable to a byte array.
> 2) capture the output of printStackTrace() including line feeds into 
> another byte array.
> 3) replace the original message of the Throwable with the entire stack 
> trace including message.

> 4) send the modified serialized Throwable off to the client.
> Client side:
> 1) Deserialize the patched Throwable into a new Throwable instance.
> 2) call fillInStackTrace on the Throwable.

That will be hard as AltRMI supports transport of any exception.  Surely to replace the
getMessage() some custom extension of the problem exception is needed.

If the client wants to do instanceof on the exception, then a general replacement exception
not be the same thing.
> Now, when you call printStackTrace, you will see the stack trace on the 
> server followed
> by the stacktrace on the client.  This would give all the information 
> needed.
> Problem is that when you call getMessage on the client, you will get a 
> message which includes
> the server-side stack trace.  Question is this worth it to make the 
> stack trace useful?

I have doubts as to suitability.

What about a debug mode which does transport the stack trace for each exception and joural
to the console on the client side.  Maybe also to logkit on the server side... 

- Paul 

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts

To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

View raw message