Skip to content

Commit e3af93f

Browse files
committed
Merge pull request #48282 from banseok1216
* pr/48282: Polish "Fix typo in ContextPairs" Fix typo in ContextPairs Closes gh-48282
2 parents ae3408f + 0b6303a commit e3af93f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/structured/ContextPairs.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public class ContextPairs {
5252
/**
5353
* Add pairs using flat naming.
5454
* @param <T> the item type
55-
* @param delimeter the delimiter used if there is a prefix
55+
* @param delimiter the delimiter used if there is a prefix
5656
* @param pairs callback to add all the pairs
5757
* @return a {@link BiConsumer} for use with the {@link JsonWriter}
5858
*/
59-
public <T> BiConsumer<T, BiConsumer<String, Object>> flat(String delimeter, Consumer<Pairs<T>> pairs) {
60-
return flat(joinWith(delimeter), pairs);
59+
public <T> BiConsumer<T, BiConsumer<String, Object>> flat(String delimiter, Consumer<Pairs<T>> pairs) {
60+
return flat(joinWith(delimiter), pairs);
6161
}
6262

6363
/**
@@ -86,12 +86,12 @@ private <T, V> BiConsumer<T, BiConsumer<String, V>> none() {
8686
};
8787
}
8888

89-
private BinaryOperator<String> joinWith(String delimeter) {
89+
private BinaryOperator<String> joinWith(String delimiter) {
9090
return (prefix, name) -> {
91-
StringBuilder joined = new StringBuilder(prefix.length() + delimeter.length() + name.length());
91+
StringBuilder joined = new StringBuilder(prefix.length() + delimiter.length() + name.length());
9292
joined.append(prefix);
93-
if (!prefix.isEmpty() && !prefix.endsWith(delimeter) && !name.startsWith(delimeter)) {
94-
joined.append(delimeter);
93+
if (!prefix.isEmpty() && !prefix.endsWith(delimiter) && !name.startsWith(delimiter)) {
94+
joined.append(delimiter);
9595
}
9696
joined.append(name);
9797
return joined.toString();

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/logging/structured/ContextPairsTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ void flatWhenPrefixAppliesPrefix() {
5858
}
5959

6060
@Test
61-
void flatWhenPrefixEndingWithDelimeterAppliesPrefix() {
61+
void flatWhenPrefixEndingWithDelimiterAppliesPrefix() {
6262
ContextPairs contextPairs = new ContextPairs(true, "the_");
6363
Map<String, String> map = Map.of("spring", "boot");
6464
Map<String, Object> actual = apply(contextPairs.flat("_", (pairs) -> pairs.addMapEntries((item) -> map)));
6565
assertThat(actual).containsOnly(entry("the_spring", "boot"));
6666
}
6767

6868
@Test
69-
void flatWhenPrefixAndNameStartingWithDelimeterAppliesPrefix() {
69+
void flatWhenPrefixAndNameStartingWithDelimiterAppliesPrefix() {
7070
ContextPairs contextPairs = new ContextPairs(true, "the");
7171
Map<String, String> map = Map.of("_spring", "boot");
7272
Map<String, Object> actual = apply(contextPairs.flat("_", (pairs) -> pairs.addMapEntries((item) -> map)));

0 commit comments

Comments
 (0)