Improve thread-safety of OnClassCondition

Closes gh-41709
This commit is contained in:
Andy Wilkinson 2024-10-24 09:43:30 +01:00
parent 0aff403234
commit b1653708e4
1 changed files with 5 additions and 3 deletions

View File

@ -165,10 +165,12 @@ class OnClassCondition extends FilteringSpringBootCondition {
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
}
if (this.failure != null) {
ReflectionUtils.rethrowRuntimeException(this.failure);
Throwable failure = this.failure;
if (failure != null) {
ReflectionUtils.rethrowRuntimeException(failure);
}
return this.outcomes;
ConditionOutcome[] outcomes = this.outcomes;
return (outcomes != null) ? outcomes : new ConditionOutcome[0];
}
}