Commit bab111b3 authored by Phillip Webb's avatar Phillip Webb

Fix ConfigurationPropertyName.equals for uppercase

Commit 7f35f8a9 for gh-14665 was unfortunately incomplete as it didn't
account for uppercase values. The run-off while loop should have used
`Character.toLowerCase` in the same way as the main while loop.

Fixes gh-15152
parent dbf09de2
......@@ -347,7 +347,7 @@ public final class ConfigurationPropertyName
}
}
while (i2 < l2) {
char ch2 = e2.charAt(i, i2++);
char ch2 = Character.toLowerCase(e2.charAt(i, i2++));
if (indexed2 || ElementsParser.isAlphaNumeric(ch2)) {
return false;
}
......
......@@ -609,6 +609,26 @@ public class ConfigurationPropertyNameTests {
assertThat(n1).isNotEqualTo(n2);
}
@Test
public void equalsWhenStartsWithOfAdaptedName() {
// gh-15152
ConfigurationPropertyName n1 = ConfigurationPropertyName
.adapt("example.mymap.ALPHA", '.');
ConfigurationPropertyName n2 = ConfigurationPropertyName
.adapt("example.mymap.ALPHA_BRAVO", '.');
assertThat(n1).isNotEqualTo(n2);
}
@Test
public void equalsWhenStartsWithOfAdaptedNameOfIllegalChars() {
// gh-15152
ConfigurationPropertyName n1 = ConfigurationPropertyName
.adapt("example.mymap.ALPH!", '.');
ConfigurationPropertyName n2 = ConfigurationPropertyName
.adapt("example.mymap.ALPHA!BRAVO", '.');
assertThat(n1).isNotEqualTo(n2);
}
@Test
public void isValidWhenValidShouldReturnTrue() {
assertThat(ConfigurationPropertyName.isValid("")).isTrue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment