Skip to content

Commit 9b35af2

Browse files
Require Java 11 (#12843)
* [java] require Java 11 * [java] remove netty http client and use native java client by default * [java] updated the list of exports * [java] use the default http client in tests * [java] removed --remote-allow-origins=* for the netty client * [java] removed the asynchttpclient and htmlunit-driver dependencies --------- Co-authored-by: Jörg Sautter <joerg.sautter@gmx.net>
1 parent cb5d98b commit 9b35af2

26 files changed

Lines changed: 43 additions & 805 deletions

.bazelrc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ build --java_runtime_version=remotejdk_17
1616
build --tool_java_language_version=17
1717
build --tool_java_runtime_version=remotejdk_17
1818

19-
# We target java 8 by default
19+
# We target java 11 by default
2020

21-
build --javacopt="--release 8"
21+
build --javacopt="--release 11"
2222

2323
# Require java dependencies to be used and first-order
2424

.github/workflows/ci-ruby.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
browser: ${{ matrix.browser }}
117117
cache-key: rb-remote-${{ matrix.browser }}-test
118118
os: ${{ matrix.os }}
119+
java-version: 11
119120
run: >
120121
bazel test
121122
--define browser=${{ matrix.browser }}

java/maven_deps.bzl

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@ def selenium_java_deps():
7575
"org.apache.commons:commons-exec:1.3",
7676
"org.apache.logging.log4j:log4j-core:2.20.0",
7777
"org.assertj:assertj-core:3.24.2",
78-
maven.artifact(
79-
group = "org.asynchttpclient",
80-
artifact = "async-http-client",
81-
version = "2.12.3",
82-
exclusions = [
83-
"io.netty:netty-transport-native-epoll",
84-
"io.netty:netty-transport-native-kqueue",
85-
],
86-
),
8778
"org.bouncycastle:bcpkix-jdk15on:1.70",
8879
"org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5",
8980
"org.hamcrest:hamcrest:2.2",

java/maven_install.json

Lines changed: 2 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
3-
"__INPUT_ARTIFACTS_HASH": 1617623649,
4-
"__RESOLVED_ARTIFACTS_HASH": 2144519154,
3+
"__INPUT_ARTIFACTS_HASH": -486878249,
4+
"__RESOLVED_ARTIFACTS_HASH": 1235473565,
55
"artifacts": {
66
"com.beust:jcommander": {
77
"shasums": {
@@ -178,20 +178,6 @@
178178
},
179179
"version": "3.2.0"
180180
},
181-
"com.sun.activation:jakarta.activation": {
182-
"shasums": {
183-
"jar": "02156773e4ae9d048d14a56ad35d644bee9f1052a791d072df3ded3c656e6e1a",
184-
"sources": "f8f52ce9df5d5d29c1778183d48214624caa36be202a7eff2cef5a0519f2aa53"
185-
},
186-
"version": "1.2.2"
187-
},
188-
"com.typesafe.netty:netty-reactive-streams": {
189-
"shasums": {
190-
"jar": "eafc52d500b49e891db095ee7baac0420aea8a97015ab7671ba1f1ccabf799d2",
191-
"sources": "76df17cc7c4fac9c470e557b5cca224df51ba878ec9fd3fd8f0f89878cbf98ab"
192-
},
193-
"version": "2.0.4"
194-
},
195181
"commons-codec:commons-codec": {
196182
"shasums": {
197183
"jar": "b3e9f6d63a790109bf0d056611fbed1cf69055826defeb9894a71369d246ed63",
@@ -629,20 +615,6 @@
629615
},
630616
"version": "3.24.2"
631617
},
632-
"org.asynchttpclient:async-http-client": {
633-
"shasums": {
634-
"jar": "107a4ace7a3586f8e8a027c6d7e9933c9ae56eeb1a6df347eed2e7b552e4e5ed",
635-
"sources": "fd7d5e61cb6e5adbb06c14b72c10c88e18ebfaf22d401a521eae14123b537900"
636-
},
637-
"version": "2.12.3"
638-
},
639-
"org.asynchttpclient:async-http-client-netty-utils": {
640-
"shasums": {
641-
"jar": "e0bb76bbca0c85c68cab25dbed7989b00db5da8627cf69258f398d7d89bc9067",
642-
"sources": "0b66a2867a3e4ea1e101e64d961d677bc6fbbbefa462b8fac461ef9101bec435"
643-
},
644-
"version": "2.12.3"
645-
},
646618
"org.bouncycastle:bcpkix-jdk15on": {
647619
"shasums": {
648620
"jar": "e5b9cb821df57f70b0593358e89c0e8d7266515da9d088af6c646f63d433c07c",
@@ -966,10 +938,6 @@
966938
"com.graphql-java:java-dataloader": [
967939
"org.slf4j:slf4j-api"
968940
],
969-
"com.typesafe.netty:netty-reactive-streams": [
970-
"io.netty:netty-handler",
971-
"org.reactivestreams:reactive-streams"
972-
],
973941
"io.grpc:grpc-context": [
974942
"io.grpc:grpc-api"
975943
],
@@ -1190,22 +1158,6 @@
11901158
"org.assertj:assertj-core": [
11911159
"net.bytebuddy:byte-buddy"
11921160
],
1193-
"org.asynchttpclient:async-http-client": [
1194-
"com.sun.activation:jakarta.activation",
1195-
"com.typesafe.netty:netty-reactive-streams",
1196-
"io.netty:netty-codec-http",
1197-
"io.netty:netty-codec-socks",
1198-
"io.netty:netty-handler",
1199-
"io.netty:netty-handler-proxy",
1200-
"org.asynchttpclient:async-http-client-netty-utils",
1201-
"org.reactivestreams:reactive-streams",
1202-
"org.slf4j:slf4j-api"
1203-
],
1204-
"org.asynchttpclient:async-http-client-netty-utils": [
1205-
"com.sun.activation:jakarta.activation",
1206-
"io.netty:netty-buffer",
1207-
"org.slf4j:slf4j-api"
1208-
],
12091161
"org.bouncycastle:bcpkix-jdk15on": [
12101162
"org.bouncycastle:bcprov-jdk15on",
12111163
"org.bouncycastle:bcutil-jdk15on"
@@ -1613,14 +1565,6 @@
16131565
"org.dataloader.stats",
16141566
"org.dataloader.stats.context"
16151567
],
1616-
"com.sun.activation:jakarta.activation": [
1617-
"com.sun.activation.registries",
1618-
"com.sun.activation.viewers",
1619-
"javax.activation"
1620-
],
1621-
"com.typesafe.netty:netty-reactive-streams": [
1622-
"com.typesafe.netty"
1623-
],
16241568
"commons-codec:commons-codec": [
16251569
"org.apache.commons.codec",
16261570
"org.apache.commons.codec.binary",
@@ -2384,42 +2328,6 @@
23842328
"org.assertj.core.util.introspection",
23852329
"org.assertj.core.util.xml"
23862330
],
2387-
"org.asynchttpclient:async-http-client": [
2388-
"org.asynchttpclient",
2389-
"org.asynchttpclient.channel",
2390-
"org.asynchttpclient.config",
2391-
"org.asynchttpclient.cookie",
2392-
"org.asynchttpclient.exception",
2393-
"org.asynchttpclient.filter",
2394-
"org.asynchttpclient.handler",
2395-
"org.asynchttpclient.handler.resumable",
2396-
"org.asynchttpclient.netty",
2397-
"org.asynchttpclient.netty.channel",
2398-
"org.asynchttpclient.netty.future",
2399-
"org.asynchttpclient.netty.handler",
2400-
"org.asynchttpclient.netty.handler.intercept",
2401-
"org.asynchttpclient.netty.request",
2402-
"org.asynchttpclient.netty.request.body",
2403-
"org.asynchttpclient.netty.ssl",
2404-
"org.asynchttpclient.netty.timeout",
2405-
"org.asynchttpclient.netty.ws",
2406-
"org.asynchttpclient.ntlm",
2407-
"org.asynchttpclient.oauth",
2408-
"org.asynchttpclient.proxy",
2409-
"org.asynchttpclient.request.body",
2410-
"org.asynchttpclient.request.body.generator",
2411-
"org.asynchttpclient.request.body.multipart",
2412-
"org.asynchttpclient.request.body.multipart.part",
2413-
"org.asynchttpclient.resolver",
2414-
"org.asynchttpclient.spnego",
2415-
"org.asynchttpclient.uri",
2416-
"org.asynchttpclient.util",
2417-
"org.asynchttpclient.webdav",
2418-
"org.asynchttpclient.ws"
2419-
],
2420-
"org.asynchttpclient:async-http-client-netty-utils": [
2421-
"org.asynchttpclient.netty.util"
2422-
],
24232331
"org.bouncycastle:bcpkix-jdk15on": [
24242332
"org.bouncycastle.cert",
24252333
"org.bouncycastle.cert.bc",
@@ -3187,10 +3095,6 @@
31873095
"com.graphql-java:graphql-java:jar:sources",
31883096
"com.graphql-java:java-dataloader",
31893097
"com.graphql-java:java-dataloader:jar:sources",
3190-
"com.sun.activation:jakarta.activation",
3191-
"com.sun.activation:jakarta.activation:jar:sources",
3192-
"com.typesafe.netty:netty-reactive-streams",
3193-
"com.typesafe.netty:netty-reactive-streams:jar:sources",
31943098
"commons-codec:commons-codec",
31953099
"commons-codec:commons-codec:jar:sources",
31963100
"commons-io:commons-io",
@@ -3318,10 +3222,6 @@
33183222
"org.apiguardian:apiguardian-api:jar:sources",
33193223
"org.assertj:assertj-core",
33203224
"org.assertj:assertj-core:jar:sources",
3321-
"org.asynchttpclient:async-http-client",
3322-
"org.asynchttpclient:async-http-client-netty-utils",
3323-
"org.asynchttpclient:async-http-client-netty-utils:jar:sources",
3324-
"org.asynchttpclient:async-http-client:jar:sources",
33253225
"org.bouncycastle:bcpkix-jdk15on",
33263226
"org.bouncycastle:bcpkix-jdk15on:jar:sources",
33273227
"org.bouncycastle:bcprov-jdk15on",
@@ -3448,10 +3348,6 @@
34483348
"com.graphql-java:graphql-java:jar:sources",
34493349
"com.graphql-java:java-dataloader",
34503350
"com.graphql-java:java-dataloader:jar:sources",
3451-
"com.sun.activation:jakarta.activation",
3452-
"com.sun.activation:jakarta.activation:jar:sources",
3453-
"com.typesafe.netty:netty-reactive-streams",
3454-
"com.typesafe.netty:netty-reactive-streams:jar:sources",
34553351
"commons-codec:commons-codec",
34563352
"commons-codec:commons-codec:jar:sources",
34573353
"commons-io:commons-io",
@@ -3579,10 +3475,6 @@
35793475
"org.apiguardian:apiguardian-api:jar:sources",
35803476
"org.assertj:assertj-core",
35813477
"org.assertj:assertj-core:jar:sources",
3582-
"org.asynchttpclient:async-http-client",
3583-
"org.asynchttpclient:async-http-client-netty-utils",
3584-
"org.asynchttpclient:async-http-client-netty-utils:jar:sources",
3585-
"org.asynchttpclient:async-http-client:jar:sources",
35863478
"org.bouncycastle:bcpkix-jdk15on",
35873479
"org.bouncycastle:bcpkix-jdk15on:jar:sources",
35883480
"org.bouncycastle:bcprov-jdk15on",

java/spotbugs-excludes.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,26 @@
145145
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
146146
</Match>
147147

148+
<Match>
149+
<Class name="org.openqa.selenium.remote.http.jdk.JdkHttpClient"/>
150+
<Bug pattern="SF_SWITCH_FALLTHROUGH"/>
151+
</Match>
152+
148153
<Match>
149154
<Class name="org.openqa.selenium.safari.SafariDriverService"/>
150155
<Bug pattern="DMI_HARDCODED_ABSOLUTE_FILENAME"/>
151156
</Match>
152157

158+
<Match>
159+
<Class name="org.openqa.selenium.support.locators.RelativeLocator$RelativeBy" />
160+
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD" />
161+
</Match>
162+
163+
<Match>
164+
<Class name="org.openqa.selenium.json.JsonOutputTest$1PrivatelyMappable" />
165+
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD" />
166+
</Match>
167+
153168
<Match>
154169
<Class name="org.openqa.selenium.testing.Pages"/>
155170
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>
@@ -165,6 +180,11 @@
165180
<Bug pattern="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD"/>
166181
</Match>
167182

183+
<Match>
184+
<Class name="org.openqa.selenium.json.JsonOutputTest"/>
185+
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
186+
</Match>
187+
168188
<Match>
169189
<Class name="org.openqa.selenium.testing.JupiterTestBase"/>
170190
<Bug pattern="URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"/>

java/src/org/openqa/selenium/chrome/ChromeDriverInfo.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import static org.openqa.selenium.remote.Browser.CHROME;
2121

2222
import com.google.auto.service.AutoService;
23-
import com.google.common.collect.ImmutableList;
24-
import com.google.common.collect.ImmutableMap;
2523
import java.util.Optional;
2624
import org.openqa.selenium.Capabilities;
2725
import org.openqa.selenium.ImmutableCapabilities;
@@ -43,17 +41,6 @@ public String getDisplayName() {
4341

4442
@Override
4543
public Capabilities getCanonicalCapabilities() {
46-
if (!"jdk-http-client".equalsIgnoreCase(System.getProperty("webdriver.http.factory", ""))) {
47-
// Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
48-
// would need to know the port used to start DevTools to establish a connection. Given
49-
// these sessions are relatively short-lived, the risk is reduced. Only set when the Java
50-
// 11 client is not used.
51-
return new ImmutableCapabilities(
52-
CapabilityType.BROWSER_NAME,
53-
CHROME.browserName(),
54-
ChromeOptions.CAPABILITY,
55-
ImmutableMap.of("args", ImmutableList.of("--remote-allow-origins=*")));
56-
}
5744
return new ImmutableCapabilities(CapabilityType.BROWSER_NAME, CHROME.browserName());
5845
}
5946

java/src/org/openqa/selenium/chromium/ChromiumOptions.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ public class ChromiumOptions<T extends ChromiumOptions<?>>
7676
public ChromiumOptions(String capabilityType, String browserType, String capability) {
7777
this.capabilityName = capability;
7878
setCapability(capabilityType, browserType);
79-
if (!"jdk-http-client".equalsIgnoreCase(System.getProperty("webdriver.http.factory", ""))) {
80-
// Allowing any origin "*" might sound risky but an attacker would need to know
81-
// the port used to start DevTools to establish a connection. Given these sessions
82-
// are relatively short-lived, the risk is reduced. Only set when the Java 11 client
83-
// is not used.
84-
addArguments("--remote-allow-origins=*");
85-
}
8679
}
8780

8881
/**

java/src/org/openqa/selenium/edge/EdgeDriverInfo.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import static org.openqa.selenium.remote.Browser.EDGE;
2121

2222
import com.google.auto.service.AutoService;
23-
import com.google.common.collect.ImmutableList;
24-
import com.google.common.collect.ImmutableMap;
2523
import java.util.Optional;
2624
import org.openqa.selenium.Capabilities;
2725
import org.openqa.selenium.ImmutableCapabilities;
@@ -43,17 +41,6 @@ public String getDisplayName() {
4341

4442
@Override
4543
public Capabilities getCanonicalCapabilities() {
46-
if (!"jdk-http-client".equalsIgnoreCase(System.getProperty("webdriver.http.factory", ""))) {
47-
// Allowing any origin "*" through remote-allow-origins might sound risky but an attacker
48-
// would need to know the port used to start DevTools to establish a connection. Given
49-
// these sessions are relatively short-lived, the risk is reduced. Only set when the Java
50-
// 11 client is not used.
51-
return new ImmutableCapabilities(
52-
CapabilityType.BROWSER_NAME,
53-
EDGE.browserName(),
54-
EdgeOptions.CAPABILITY,
55-
ImmutableMap.of("args", ImmutableList.of("--remote-allow-origins=*")));
56-
}
5744
return new ImmutableCapabilities(CapabilityType.BROWSER_NAME, EDGE.browserName());
5845
}
5946

java/src/org/openqa/selenium/grid/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ maven_bom(
110110
"//java/src/org/openqa/selenium/json:json",
111111
"//java/src/org/openqa/selenium/lift:lift",
112112
"//java/src/org/openqa/selenium/manager:manager",
113-
"//java/src/org/openqa/selenium/remote/http/jdk:jdk",
114113
"//java/src/org/openqa/selenium/remote/http:http",
115114
"//java/src/org/openqa/selenium/remote:remote",
116115
"//java/src/org/openqa/selenium/safari:safari",

java/src/org/openqa/selenium/remote/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ java_library(
5555
"//java/src/org/openqa/selenium/json",
5656
"//java/src/org/openqa/selenium/manager",
5757
"//java/src/org/openqa/selenium/os",
58-
"//java/src/org/openqa/selenium/remote/http/netty",
58+
"//java/src/org/openqa/selenium/remote/http/jdk",
5959
"//java/src/org/openqa/selenium/remote/tracing",
6060
"//java/src/org/openqa/selenium/remote/tracing/opentelemetry",
6161
"//java/src/org/openqa/selenium/support/decorators",

0 commit comments

Comments
 (0)