return empty stack trace for thread which isn't running

This commit is contained in:
Joel Dice 2009-10-26 11:44:29 -06:00
parent 53588b94f3
commit a68742200b

View File

@ -186,7 +186,11 @@ public class Thread implements Runnable {
}
public StackTraceElement[] getStackTrace() {
return Throwable.resolveTrace(getStackTrace(peer));
long p = peer;
if (p == 0) {
return new StackTraceElement[0];
}
return Throwable.resolveTrace(getStackTrace(p));
}
private static native Object getStackTrace(long peer);