From 33deba4948c8589d51e36dd616be915c96fc81cd Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Fri, 5 Jun 2020 15:51:28 -0700 Subject: [PATCH] Use chars rather than strings Update `SystemEnvironmentPropertyMapper` to use single chars rather than strings whenever possible. See gh-21523 --- .../properties/source/SystemEnvironmentPropertyMapper.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 eb50e0d2c96..19775ab8178 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 @@ -58,7 +58,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { StringBuilder result = new StringBuilder(); for (int i = 0; i < numberOfElements; i++) { if (result.length() > 0) { - result.append("_"); + result.append('_'); } result.append(name.getElement(i, Form.UNIFORM).toUpperCase(Locale.ENGLISH)); } @@ -69,7 +69,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { StringBuilder result = new StringBuilder(); for (int i = 0; i < name.getNumberOfElements(); i++) { if (result.length() > 0) { - result.append("_"); + result.append('_'); } result.append(convertLegacyNameElement(name.getElement(i, Form.ORIGINAL))); } @@ -118,7 +118,7 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { } StringBuilder legacyCompatibleName = new StringBuilder(); for (int i = 0; i < name.getNumberOfElements(); i++) { - legacyCompatibleName.append((i != 0) ? "." : ""); + legacyCompatibleName.append((i != 0) ? '.' : ""); legacyCompatibleName.append(name.getElement(i, Form.DASHED).replace('-', '.')); } return ConfigurationPropertyName.isValid(legacyCompatibleName)