From f8d6d9a4b0dac75c6733afa96c4f92b62db1f948 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 5 Jun 2020 15:58:13 -0700 Subject: [PATCH] Call append only when necessary See gh-21523 --- .../properties/source/SystemEnvironmentPropertyMapper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java index 19775ab817..c6632c4545 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java @@ -118,7 +118,9 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { } StringBuilder legacyCompatibleName = new StringBuilder(); for (int i = 0; i < name.getNumberOfElements(); i++) { - legacyCompatibleName.append((i != 0) ? '.' : ""); + if (i != 0) { + legacyCompatibleName.append('.'); + } legacyCompatibleName.append(name.getElement(i, Form.DASHED).replace('-', '.')); } return ConfigurationPropertyName.isValid(legacyCompatibleName)