The following code:

        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        t.printStackTrace(pw);
        pw.flush();
        String result = sw.toString();

when t is a FunctionCallException, seems to print the stack trace to
standard error instead of to the Writer.  The String "result" is
empty.  If you're making a unit test for this bug, an easy way to get
a FunctionCallException is to evaluate "id()".

I think the problem is the following in FunctionCallException.java:

    public void printStackTrace( PrintStream s ) {
        super.printStackTrace();
        if ( nestedException != null ) 
        {
            s.println( "Root cause:" );
            nestedException.printStackTrace( s );
        }
    }
    
    public void printStackTrace( PrintWriter w ) {
        super.printStackTrace();
        if ( nestedException != null ) 
        {
            w.println( "Root cause:" );
            nestedException.printStackTrace( w );
        }
    }

The calls to "super.printStackTrace()" should be
super.printStackTrace(s) and super.printStackTrace(w) respectively.

Or, you can just use the JDK 1.4 Throwable, but that would suck for
backward compatibility.

Not sure if this is in other files too; this is the one I hit it in.  

 - A


-- 
Alex Chaffee                       mailto:[EMAIL PROTECTED]
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/

_______________________________________________
Jaxen-interest mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jaxen-interest

Reply via email to