Skip to content

Commit

Permalink
[java] add deprecation notices to Grid logs and Java stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
titusfortner authored and diemol committed May 25, 2022
1 parent d74f1a2 commit b38206f
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion java/src/org/openqa/selenium/remote/ProtocolHandshake.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.Function;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
Expand All @@ -63,7 +65,19 @@ public Result createSession(HttpHandler client, Command command) throws IOExcept

if (result.isRight()) {
Result toReturn = result.right();
LOG.info(String.format("Detected dialect: %s", toReturn.dialect));
LOG.info(String.format("Detected upstream dialect: %s", toReturn.dialect));

List<String> invalid = desired.asMap().keySet()
.stream()
.filter(key -> !(new AcceptedW3CCapabilityKeys().test(key)))
.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));
}
return toReturn;
} else {
throw result.left();
Expand Down

0 comments on commit b38206f

Please sign in to comment.