Skip to content

Commit b165370

Browse files
committed
Improve thread-safety of OnClassCondition
Closes gh-41709
1 parent 0aff403 commit b165370

File tree

1 file changed

+5
-3
lines changed
  • spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/condition

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@ public ConditionOutcome[] resolveOutcomes() {
165165
catch (InterruptedException ex) {
166166
Thread.currentThread().interrupt();
167167
}
168-
if (this.failure != null) {
169-
ReflectionUtils.rethrowRuntimeException(this.failure);
168+
Throwable failure = this.failure;
169+
if (failure != null) {
170+
ReflectionUtils.rethrowRuntimeException(failure);
170171
}
171-
return this.outcomes;
172+
ConditionOutcome[] outcomes = this.outcomes;
173+
return (outcomes != null) ? outcomes : new ConditionOutcome[0];
172174
}
173175

174176
}

0 commit comments

Comments
 (0)