You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public Throwable appendTo(Throwable throwable) {
Throwable t = throwable;
while (t.getCause() != null) {
t = t.getCause();
// Won't be able to init the cause of this with self
if (t == this) {
return throwable;
}
if (logLevel == LogLevel.SHOW_ONLY_FIRST && t instanceof TraceurException) {
return throwable;
}
}
t.initCause(this);
return throwable;
}
but the code inside Throwable is
public synchronized Throwable initCause(Throwable cause) {
if (this.cause != this)
throw new IllegalStateException("Can't overwrite cause with " +
Objects.toString(cause, "a null"), this);
if (cause == this)
throw new IllegalArgumentException("Self-causation not permitted", this);
this.cause = cause;
return this;
}
This means the appendTo function will cause an exception to be thrown if a Throwable's cause is ever found to be null.
Possible solution while (t.getCause() != null) should be while (t.getCause() != null && t.getCause() != t) and wrap the t.initCause(this);with a check againstt.getCause()`'s nullability
I'll make a PR later with this
The text was updated successfully, but these errors were encountered:
So your code in
TraceurException
isbut the code inside
Throwable
isThis means the
appendTo
function will cause an exception to be thrown if a Throwable's cause is ever found to be null.Possible solution
while (t.getCause() != null)
should bewhile (t.getCause() != null && t.getCause() != t)
andwrap the
t.initCause(this);with a check against
t.getCause()`'s nullabilityI'll make a PR later with this
The text was updated successfully, but these errors were encountered: