Call append only when necessary

See gh-21523
This commit is contained in:
dreis2211 2020-06-05 15:58:13 -07:00 committed by Phillip Webb
parent 33deba4948
commit f8d6d9a4b0
1 changed files with 3 additions and 1 deletions

View File

@ -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)