mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
don't try to print null exception trace in printTrace
It is possible to create an Exception with no stack trace by overriding Throwable.fillInStackTrace, so we can't assume any given instance will have one.
This commit is contained in:
parent
4db79b9be6
commit
8fb9523de5
@ -3904,26 +3904,28 @@ printTrace(Thread* t, object exception)
|
||||
}
|
||||
|
||||
object trace = throwableTrace(t, e);
|
||||
for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) {
|
||||
object e = objectArrayBody(t, trace, i);
|
||||
const int8_t* class_ = &byteArrayBody
|
||||
(t, className(t, methodClass(t, traceElementMethod(t, e))), 0);
|
||||
const int8_t* method = &byteArrayBody
|
||||
(t, methodName(t, traceElementMethod(t, e)), 0);
|
||||
int line = t->m->processor->lineNumber
|
||||
(t, traceElementMethod(t, e), traceElementIp(t, e));
|
||||
if (trace) {
|
||||
for (unsigned i = 0; i < objectArrayLength(t, trace); ++i) {
|
||||
object e = objectArrayBody(t, trace, i);
|
||||
const int8_t* class_ = &byteArrayBody
|
||||
(t, className(t, methodClass(t, traceElementMethod(t, e))), 0);
|
||||
const int8_t* method = &byteArrayBody
|
||||
(t, methodName(t, traceElementMethod(t, e)), 0);
|
||||
int line = t->m->processor->lineNumber
|
||||
(t, traceElementMethod(t, e), traceElementIp(t, e));
|
||||
|
||||
fprintf(stderr, " at %s.%s ", class_, method);
|
||||
fprintf(stderr, " at %s.%s ", class_, method);
|
||||
|
||||
switch (line) {
|
||||
case NativeLine:
|
||||
fprintf(stderr, "(native)\n");
|
||||
break;
|
||||
case UnknownLine:
|
||||
fprintf(stderr, "(unknown line)\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "(line %d)\n", line);
|
||||
switch (line) {
|
||||
case NativeLine:
|
||||
fprintf(stderr, "(native)\n");
|
||||
break;
|
||||
case UnknownLine:
|
||||
fprintf(stderr, "(unknown line)\n");
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "(line %d)\n", line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user