Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
Use StringUtils#hasText

PR gh-13179
  • Loading branch information
jzheaux committed May 17, 2023
1 parent 4de201a commit 9583b06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.commons.logging.LogFactory;

import org.springframework.core.log.LogMessage;
import org.springframework.util.StringUtils;

/**
* A {@link org.springframework.security.web.FilterChainProxy.FilterChainDecorator} that
Expand Down Expand Up @@ -519,8 +520,8 @@ public KeyValues getLowCardinalityKeyValues(FilterChainObservationContext contex
return KeyValues.of(CHAIN_SIZE_NAME, String.valueOf(context.getChainSize()))
.and(CHAIN_POSITION_NAME, String.valueOf(context.getChainPosition()))
.and(FILTER_SECTION_NAME, context.getFilterSection())
.and(FILTER_NAME, (context.getFilterName() != null && !context.getFilterName().isEmpty())
? context.getFilterName() : KeyValue.NONE_VALUE);
.and(FILTER_NAME, (StringUtils.hasText(context.getFilterName())) ? context.getFilterName()
: KeyValue.NONE_VALUE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
Expand Down Expand Up @@ -689,8 +690,8 @@ public KeyValues getLowCardinalityKeyValues(WebFilterChainObservationContext con
return KeyValues.of(CHAIN_SIZE_NAME, String.valueOf(context.getChainSize()))
.and(CHAIN_POSITION_NAME, String.valueOf(context.getChainPosition()))
.and(FILTER_SECTION_NAME, context.getFilterSection())
.and(FILTER_NAME, (context.getFilterName() != null && !context.getFilterName().isEmpty())
? context.getFilterName() : KeyValue.NONE_VALUE);
.and(FILTER_NAME, (StringUtils.hasText(context.getFilterName())) ? context.getFilterName()
: KeyValue.NONE_VALUE);
}

@Override
Expand Down

0 comments on commit 9583b06

Please sign in to comment.