Skip to content

Commit d344088

Browse files
committed
Polish "Avoid unnecessary pattern compilation in WebFluxTags"
See gh-24147
1 parent b22bb7e commit d344088

File tree

1 file changed

+7
-7
lines changed
  • spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server

1 file changed

+7
-7
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/reactive/server/WebFluxTags.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,20 +131,20 @@ public static Tag uri(ServerWebExchange exchange, boolean ignoreTrailingSlash) {
131131
return URI_UNKNOWN;
132132
}
133133

134-
private static String removeTrailingSlash(String text) {
135-
if (!StringUtils.hasLength(text)) {
136-
return text;
137-
}
138-
return text.endsWith("/") ? text.substring(0, text.length() - 1) : text;
139-
}
140-
141134
private static String getPathInfo(ServerWebExchange exchange) {
142135
String path = exchange.getRequest().getPath().value();
143136
String uri = StringUtils.hasText(path) ? path : "/";
144137
String singleSlashes = FORWARD_SLASHES_PATTERN.matcher(uri).replaceAll("/");
145138
return removeTrailingSlash(singleSlashes);
146139
}
147140

141+
private static String removeTrailingSlash(String text) {
142+
if (!StringUtils.hasLength(text)) {
143+
return text;
144+
}
145+
return text.endsWith("/") ? text.substring(0, text.length() - 1) : text;
146+
}
147+
148148
/**
149149
* Creates an {@code exception} tag based on the {@link Class#getSimpleName() simple
150150
* name} of the class of the given {@code exception}.

0 commit comments

Comments
 (0)