From 7203962b2be0e7f950d07b1be80bc65b22380462 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Fri, 27 Sep 2024 12:13:22 -0500 Subject: [PATCH] minor cleanup --- .../elasticsearch/rest/RestController.java | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/rest/RestController.java b/server/src/main/java/org/elasticsearch/rest/RestController.java index b8d064c6dec51..f97c8820bb426 100644 --- a/server/src/main/java/org/elasticsearch/rest/RestController.java +++ b/server/src/main/java/org/elasticsearch/rest/RestController.java @@ -34,7 +34,6 @@ import org.elasticsearch.core.RestApiVersion; import org.elasticsearch.core.Streams; import org.elasticsearch.core.TimeValue; -import org.elasticsearch.core.UpdateForV9; import org.elasticsearch.http.HttpHeadersValidationException; import org.elasticsearch.http.HttpRouteStats; import org.elasticsearch.http.HttpServerTransport; @@ -155,7 +154,6 @@ public ServerlessApiProtections getApiProtections() { * @param deprecationMessage The message to log and send as a header in the response * @param deprecationLevel The deprecation log level to use for the deprecation warning, either WARN or CRITICAL */ - @UpdateForV9 // comment in the "assert false" below when V_7 is no longer supported protected void registerAsDeprecatedHandler( RestRequest.Method method, String path, @@ -165,28 +163,20 @@ protected void registerAsDeprecatedHandler( Level deprecationLevel ) { assert (handler instanceof DeprecationRestHandler) == false; - if (version == RestApiVersion.current()) { - // e.g. it was marked as deprecated in 9.x, and we're currently running 9.x - registerHandler( - method, - path, - version, - new DeprecationRestHandler(handler, method, path, deprecationLevel, deprecationMessage, deprecationLogger, false) - ); - } else if (version == RestApiVersion.minimumSupported()) { - // e.g. it was marked as last fully supported in 8.x, and we're currently running 9.x - registerHandler( + registerHandler( + method, + path, + version, + new DeprecationRestHandler( + handler, method, path, - version, - new DeprecationRestHandler(handler, method, path, deprecationLevel, deprecationMessage, deprecationLogger, true) - ); - } else { - // e.g. it was marked as deprecated in 7.x, and we're currently running 9.x - // should never happen as we only support the current and current -1 versions - // TODO: comment this back in when V_7 is no longer supported - // assert false : "Unsupported REST API version " + version; - } + deprecationLevel, + deprecationMessage, + deprecationLogger, + version != RestApiVersion.current() + ) + ); } /**