Browse Source

Improve thread-safety of OnClassCondition

Closes gh-41709
pull/42986/head
Andy Wilkinson 1 year ago
parent
commit
b1653708e4
  1. 8
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java

8
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition/OnClassCondition.java

@ -165,10 +165,12 @@ class OnClassCondition extends FilteringSpringBootCondition { @@ -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];
}
}

Loading…
Cancel
Save