diff --git a/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java b/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java index 317d1d563..5b4d5c610 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/RateLimitingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2014 Netflix, Inc. + * Copyright 2014, 2024 Netflix, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -149,8 +149,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha private static Target getTarget(ServletRequest request) { Target target = Target.Other; - if (request instanceof HttpServletRequest) { - HttpServletRequest httpRequest = (HttpServletRequest) request; + if (request instanceof HttpServletRequest httpRequest) { String pathInfo = httpRequest.getRequestURI(); if ("GET".equals(httpRequest.getMethod()) && pathInfo != null) { diff --git a/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java b/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java index 26a4a217d..0412901bf 100644 --- a/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java +++ b/eureka-core/src/main/java/com/netflix/eureka/ServerRequestAuthFilter.java @@ -59,9 +59,7 @@ public void destroy() { protected void logAuth(ServletRequest request) { if (serverConfig.shouldLogIdentityHeaders()) { - if (request instanceof HttpServletRequest) { - HttpServletRequest httpRequest = (HttpServletRequest) request; - + if (request instanceof HttpServletRequest httpRequest) { String clientName = getHeader(httpRequest, AbstractEurekaIdentity.AUTH_NAME_HEADER_KEY); String clientVersion = getHeader(httpRequest, AbstractEurekaIdentity.AUTH_VERSION_HEADER_KEY);