From a89e6ff67c20cc55266fa67837a620ff7b5fb80c Mon Sep 17 00:00:00 2001 From: Johnny Lim Date: Sat, 27 Apr 2019 00:27:33 +0900 Subject: [PATCH] Polish dashIgnoringElementEquals() See gh-16671 --- .../properties/source/ConfigurationPropertyName.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 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 facf2a9539f..bcc4038c2e4 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 @@ -394,12 +394,16 @@ public final class ConfigurationPropertyName i2++; } } - boolean indexed2 = e2.getType(i).isIndexed(); - while (i2 < l2) { - char ch2 = e2.charAt(i, i2++); - if (indexed2 || ch2 != '-') { + if (i2 < l2) { + if (e2.getType(i).isIndexed()) { return false; } + do { + if (e2.charAt(i, i2++) != '-') { + return false; + } + } + while (i2 < l2); } return true; }