Commit 6fba477d authored by Andy Wilkinson's avatar Andy Wilkinson

Remove redundant handling of a null exchange from WebFluxTags.uri()

Closes gh-14504
parent 6020cb67
...@@ -40,8 +40,6 @@ public final class WebFluxTags { ...@@ -40,8 +40,6 @@ public final class WebFluxTags {
private static final Tag URI_ROOT = Tag.of("uri", "root"); private static final Tag URI_ROOT = Tag.of("uri", "root");
private static final Tag URI_UNKNOWN = Tag.of("uri", "UNKNOWN");
private static final Tag EXCEPTION_NONE = Tag.of("exception", "None"); private static final Tag EXCEPTION_NONE = Tag.of("exception", "None");
private WebFluxTags() { private WebFluxTags() {
...@@ -80,7 +78,6 @@ public final class WebFluxTags { ...@@ -80,7 +78,6 @@ public final class WebFluxTags {
* @return the uri tag derived from the exchange * @return the uri tag derived from the exchange
*/ */
public static Tag uri(ServerWebExchange exchange) { public static Tag uri(ServerWebExchange exchange) {
if (exchange != null) {
PathPattern pathPattern = exchange PathPattern pathPattern = exchange
.getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE); .getAttribute(HandlerMapping.BEST_MATCHING_PATTERN_ATTRIBUTE);
if (pathPattern != null) { if (pathPattern != null) {
...@@ -99,8 +96,6 @@ public final class WebFluxTags { ...@@ -99,8 +96,6 @@ public final class WebFluxTags {
} }
return Tag.of("uri", path); return Tag.of("uri", path);
} }
return URI_UNKNOWN;
}
/** /**
* Creates an {@code exception} tag based on the {@link Class#getSimpleName() simple * Creates an {@code exception} tag based on the {@link Class#getSimpleName() simple
......
...@@ -78,12 +78,6 @@ public class WebFluxTagsTests { ...@@ -78,12 +78,6 @@ public class WebFluxTagsTests {
assertThat(tag.getValue()).isEqualTo("root"); assertThat(tag.getValue()).isEqualTo("root");
} }
@Test
public void uriTagIsUnknownWhenRequestIsNull() {
Tag tag = WebFluxTags.uri(null);
assertThat(tag.getValue()).isEqualTo("UNKNOWN");
}
@Test @Test
public void methodTagToleratesNonStandardHttpMethods() { public void methodTagToleratesNonStandardHttpMethods() {
ServerWebExchange exchange = mock(ServerWebExchange.class); ServerWebExchange exchange = mock(ServerWebExchange.class);
......
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