commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henri Yandell <bay...@generationjava.com>
Subject [lang] RE: Exception to XML?
Date Wed, 22 Jan 2003 19:41:50 GMT

I think you're right. Looks like we need to make a few improvements:

1) getStackTrace: Should this handle nested?

public static String getStackTrace(Throwable t) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw, true);
    Throwable ts = getThrowables(t);
    for(int i=0; i<ts.length; i++) {
        ts[i].printStackTrace(pw);
        if(isCauseMethod(ts[i])) {
            break;
        }
    }
    return sw.getBuffer().toString()
}

static public boolean isCauseMethod(Throwable t) {
    // checks if this is a 'nested' exception. if so we trust it
    // to print itself and its children (?)
}

2)
  public void printStackTrace(Throwable t, PrintStream)  [calls
getStackTrace]
  public void printStackTrace(Throwable, PrintWriter)

Any views?

On Wed, 22 Jan 2003, Gary Gregory wrote:

> Hm, I do not see ExceptionUtils.toString(Throwable) in Commons-Lang v.1.0.1
> or in CVS (as of v.1.20, the latest as far as I can tell). To be more
> specific, what I really want to is something that will work with a
> NestableException or a JRE 1.4 Exception.
>
> Gary
>
> -----Original Message-----
> From: scolebourne@btopenworld.com [mailto:scolebourne@btopenworld.com]
> Sent: Wednesday, January 22, 2003 10:00 AM
> To: commons-user@jakarta.apache.org
> Subject: Re: Exception to XML?
>
>
> ExceptionUtils.toString(Throwable) IIRC.
> Stephen
>
> >  from:    Gary Gregory <ggregory@seagullsw.com>
> >  date:    Wed, 22 Jan 2003 17:11:39
> >  to:      commons-user@jakarta.apache.org
> >  subject: Re: Exception to XML?
> >
> > Hello All,
> >
> > Is there something somewhere in the Commons or XML project that will let
> me
> > turn an Exception in XML (DOM or String)? I would then use this XML
> snippet
> > as part of a larger enclosing document.
> >
> > Thank you,
> > Gary
>
>
> --
> To unsubscribe, e-mail:
> <mailto:commons-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:commons-user-help@jakarta.apache.org>
>


Mime
View raw message