Skip to content

Commit 32c196f

Browse files
authored
Fix HLRC compatibility with Java 8 (#74290)
Optional.isEmpty() was added in Java 11. In Java 8 we only have Optional.isPresent()
1 parent 5f8be72 commit 32c196f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,7 @@ void runIfNotCancelled(Runnable runnable) {
20432043
versionCheck.addListener(new ActionListener<Optional<String>>() {
20442044
@Override
20452045
public void onResponse(Optional<String> validation) {
2046-
if (validation.isEmpty()) {
2046+
if (validation.isPresent() == false) {
20472047
// Send the request and propagate cancellation
20482048
Cancellable call = client.performRequestAsync(request, listener);
20492049
cancellationForwarder.whenComplete((r, t) ->
@@ -2078,7 +2078,7 @@ private Response performClientRequest(Request request) throws IOException {
20782078
throw new ElasticsearchException(e);
20792079
}
20802080

2081-
if (versionValidation.isEmpty()) {
2081+
if (versionValidation.isPresent() == false) {
20822082
return client.performRequest(request);
20832083
} else {
20842084
throw new ElasticsearchException(versionValidation.get());

0 commit comments

Comments
 (0)