Skip to content

Commit afaf332

Browse files
pujaganidiemol
authored andcommitted
[java] Lazily concatenate string while logging
1 parent b38206f commit afaf332

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

java/src/org/openqa/selenium/remote/ProtocolHandshake.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@
4141
import java.util.Map;
4242
import java.util.Objects;
4343
import java.util.function.Function;
44+
import java.util.logging.Level;
4445
import java.util.logging.Logger;
4546
import java.util.stream.Collectors;
4647
import java.util.stream.Stream;
4748

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

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

0 commit comments

Comments
 (0)