-
Enhancement
-
Resolution: Cannot Reproduce
-
P5
-
None
-
1.1.2, 1.1.5, 1.2.2, 1.3.1
-
generic, x86, sparc
-
generic, solaris_2.5.1, windows_98, windows_nt
Name: rm29839 Date: 12/09/97
One thing that would be quite useful for me
would be if you could make an exception with
a custom backtrace. For example, if I have
a new subsystem that I want to define, I may
want the stack traces that come out of it to
be more symbolic than simply original source
method, file and line number. For example, if
I'm writing a new interpreter, I might want to
provide source lines from that interpreted
language rather than from the Java VM. Another
example would be if I wanted to make an opaque
subsystem, then I could filter out internal
code details on any exceptions that I pass out
of the subsystem.
The two things that would make this work possible
would be:
1. A method on Throwable to get a structured
backtrace. For example:
String[] getBacktrace();
which would return a string, in a well-known
format, per line of backtrace. This would make
it easy for intermediate code to manipulate a
stack backtrace for subsequent use.
2. A standard constructor for Throwable that
takes such a structured backtrace to use in
place of the "default" one. For example:
public Throwable(String detailMessage,
String[] backtrace);
which would use the given backtrace instead
of generating one based on the current dynamic
context.
Dan Bornstein
###@###.###
(Review ID: 21577)
======================================================================
Name: tb29552 Date: 03/23/2000
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
Java needs a decent mechanism to access the stack traceback.
So far the only way I know to get at the stack trace from
a Java class is to create a Throwable and parse the String
available therefrom. This is expensive and unreliable.
There should be a StackTrace class that contains multiple
instances of a StackTraceElement class. Throwable would
contain an instance of StackTrace. StackTrace.toString()
would format the entire trace to String in the format that
is currently printed by Throwable.printStackTrace().
Java can make things so easy, but not always!
(Review ID: 102773)
======================================================================
- duplicates
-
JDK-4074976 Can't get Stack Trace into string easily; the only option is to print it.
- Closed
- relates to
-
JDK-4375402 Add ability to obtain full thread dump programmatically
- Closed