From 47c1928189b77b0a0687325242ffbd3e7b7f7698 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 5 Jun 2020 16:10:36 -0700 Subject: [PATCH] Polish 'Optimize SystemEnvironmentPropertyMapper' Introduce a new `ConfigurationPropertyName.ofIfValid` method to save us needing to throw and catch an exception unnecessarily. See gh-21523 --- .../source/ConfigurationPropertyName.java | 12 ++++++++++++ .../source/SystemEnvironmentPropertyMapper.java | 13 ++++--------- .../source/ConfigurationPropertyNameTests.java | 12 ++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java index ec2bdbca570..2c8bd8b64e4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/ConfigurationPropertyName.java @@ -510,6 +510,18 @@ public final class ConfigurationPropertyName implements Comparable ConfigurationPropertyName.adapt(null, '.'))