Skip to content

Commit

Permalink
[java] Lazily concatenate string while logging
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani authored and diemol committed May 25, 2022
1 parent b38206f commit afaf332
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions java/src/org/openqa/selenium/remote/ProtocolHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.net.HttpHeaders.WARNING;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.openqa.selenium.json.Json.JSON_UTF_8;
import static org.openqa.selenium.remote.CapabilityType.PROXY;
Expand All @@ -73,10 +75,11 @@ public Result createSession(HttpHandler client, Command command) throws IOExcept
.collect(Collectors.toList());

if (!invalid.isEmpty()) {
LOG.warning(String.format("Support for Legacy Capabilities is deprecated; " +
"You are sending the following invalid capabilities: %s; " +
"Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/",
invalid));
LOG.log(Level.WARNING,
() -> String.format("Support for Legacy Capabilities is deprecated; " +
"You are sending the following invalid capabilities: %s; " +
"Please update to W3C Syntax: https://www.selenium.dev/blog/2022/legacy-protocol-support/",
invalid));
}
return toReturn;
} else {
Expand Down

0 comments on commit afaf332

Please sign in to comment.