align to checkstyle

pull/251/head
cheese8 3 years ago
parent 4d14344b70
commit de3b6d8745

@ -71,12 +71,11 @@ public class PolarisFeignLoadBalancer extends FeignLoadBalancer {
routerContext.setLabels(PolarisRouterContext.TRANSITIVE_LABELS, MetadataContextHolder.get()
.getFragmentContext(MetadataContext.FRAGMENT_TRANSITIVE));
Map<String, String> labelHeaderValuesMap = new HashMap<>();
try{
try {
String labelHeaderValuesContent = labelHeaderValues.stream().findFirst().get();
labelHeaderValuesMap.putAll(JacksonUtils.deserialize2Map(URLDecoder.decode(labelHeaderValuesContent,
StandardCharsets.UTF_8.name())));
labelHeaderValuesMap.putAll(JacksonUtils.deserialize2Map(URLDecoder.decode(labelHeaderValuesContent, StandardCharsets.UTF_8.name())));
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("unsupported charset exception " + StandardCharsets.UTF_8.name());
}

@ -109,9 +109,9 @@ public class RouterLabelFeignInterceptor implements RequestInterceptor, Ordered
requestTemplate.header(RouterConstants.ROUTER_LABEL_HEADER);
return;
}
String encodedLabelsContent;
try{
try {
encodedLabelsContent = URLEncoder.encode(JacksonUtils.serialize2Json(labels), StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("unsupported charset exception " + StandardCharsets.UTF_8.name());

@ -118,10 +118,10 @@ public class RouterLabelFeignInterceptorTest {
when(metadataLocalProperties.getContent()).thenReturn(localMetadata);
routerLabelFeignInterceptor.apply(requestTemplate);
Collection<String> routerLabels = requestTemplate.headers().get(RouterConstants.ROUTER_LABEL_HEADER);
Map<String, String> routerLabelsMap = new HashMap<>();
try{
try {
String routerLabelContent = routerLabels.stream().findFirst().get();
routerLabelsMap.putAll(JacksonUtils.deserialize2Map(URLDecoder.decode(routerLabelContent, StandardCharsets.UTF_8.name())));
} catch (UnsupportedEncodingException e) {

Loading…
Cancel
Save