Debugging stack data not assigned to a named variable

Posted by gibbss on Stack Overflow See other posts from Stack Overflow or by gibbss
Published on 2010-05-26T19:13:49Z Indexed on 2010/05/26 19:21 UTC
Read the original article Hit count: 254

Filed under:
|

Is there a way to view stack elements like un-assigned return values or exceptions that not assigned to a local variable? (e.g. throw new ...)

For example, suppose I have code along the lines of:

public String foo(InputStream in) throws IOException {    
    NastyObj obj = null;
    try {
        obj = new NastyObj(in);
        return (obj.read());
    } finally {
        if (obj != null) obj.close();
    }
}

Is there any way to view the return or exception value without stepping to a higher level frame where it is assigned? This is particularly relevant with exceptions because you often have to step back up through a number of frames to find an actual handler.

I usually use the Eclipse debugging environment, but any answer is appreciated. Also, if this cannot be done, can you explain why? (JVM, JPDA limitation?)

© Stack Overflow or respective owner

Related posts about java

Related posts about debugging