From 57009d562391c9b1b388a67f7f1961289f87c519 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 23 Feb 2022 19:00:19 -0800 Subject: [PATCH] Polish --- .../autoconfigure/security/SecurityProperties.java | 2 +- .../boot/SpringApplicationShutdownHook.java | 10 +++------- .../boot/context/properties/bind/DefaultValue.java | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index e84faa7bc453..aa2b859c5a81 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationShutdownHook.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationShutdownHook.java index 090462ac6207..274ca9d476bb 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationShutdownHook.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplicationShutdownHook.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -95,12 +95,8 @@ void addRuntimeShutdownHook() { void deregisterFailedApplicationContext(ConfigurableApplicationContext applicationContext) { synchronized (SpringApplicationShutdownHook.class) { - if (!applicationContext.isActive()) { - SpringApplicationShutdownHook.this.contexts.remove(applicationContext); - } - else { - throw new IllegalStateException("Cannot unregister active application context"); - } + Assert.state(!applicationContext.isActive(), "Cannot unregister active application context"); + SpringApplicationShutdownHook.this.contexts.remove(applicationContext); } } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java index d17eb605eecc..257b37514c96 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/DefaultValue.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2021 the original author or authors. + * Copyright 2012-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.