Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelandis committed Sep 27, 2024
1 parent 808f41f commit 7203962
Showing 1 changed file with 12 additions and 22 deletions.
34 changes: 12 additions & 22 deletions server/src/main/java/org/elasticsearch/rest/RestController.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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()
)
);
}

/**
Expand Down

0 comments on commit 7203962

Please sign in to comment.