Skip to content

Commit c5b3dbc

Browse files
authored
Fix stack trace in ActionListener#assertOnce (elastic#124672) (elastic#124713)
In elastic#112380 we changed this `assert` to yield a `String` on failure rather than the original `ElasticsearchException`, which means we don't see the original completion's stack trace any more. This commit reinstates the lost stack trace.
1 parent 6c9ecb1 commit c5b3dbc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/main/java/org/elasticsearch/action/ActionListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ static <Response> ActionListener<Response> assertOnce(ActionListener<Response> d
390390

391391
private void assertFirstRun() {
392392
var previousRun = firstCompletion.compareAndExchange(null, new ElasticsearchException("executed already"));
393-
assert previousRun == null : "[" + delegate + "] " + previousRun; // reports the stack traces of both completions
393+
assert previousRun == null
394+
// reports the stack traces of both completions
395+
: new AssertionError("[" + delegate + "]", previousRun);
394396
}
395397

396398
@Override

0 commit comments

Comments
 (0)