Skip to content

Commit 7e0210c

Browse files
committed
[java] Run the format script
1 parent fe1df0f commit 7e0210c

4 files changed

Lines changed: 38 additions & 21 deletions

File tree

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,10 @@ protected ChromiumDriver(
133133

134134
this.biDi = createBiDi(biDiUri);
135135

136-
Optional<URI> reportedUri = CdpEndpointFinder.getReportedUri(capabilityKey, originalCapabilities);
137-
Optional<HttpClient> client = reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
136+
Optional<URI> reportedUri =
137+
CdpEndpointFinder.getReportedUri(capabilityKey, originalCapabilities);
138+
Optional<HttpClient> client =
139+
reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
138140
Optional<URI> cdpUri;
139141

140142
try {

java/src/org/openqa/selenium/devtools/SeleniumCdpConnection.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,19 @@ public static Optional<Connection> create(
5454
Require.nonNull("HTTP client factory", clientFactory);
5555
Require.nonNull("Capabilities", capabilities);
5656

57-
58-
Optional<URI> cdpUri = Optional
59-
.ofNullable(capabilities.getCapability("se:cdp"))
60-
.flatMap((uri) -> {
61-
if (uri instanceof String) {
62-
try {
63-
return Optional.of(new URI((String) uri));
64-
} catch (URISyntaxException e) {
65-
return Optional.empty();
66-
}
67-
}
68-
return Optional.empty();
69-
});
57+
Optional<URI> cdpUri =
58+
Optional.ofNullable(capabilities.getCapability("se:cdp"))
59+
.flatMap(
60+
(uri) -> {
61+
if (uri instanceof String) {
62+
try {
63+
return Optional.of(new URI((String) uri));
64+
} catch (URISyntaxException e) {
65+
return Optional.empty();
66+
}
67+
}
68+
return Optional.empty();
69+
});
7070

7171
Optional<HttpClient> client;
7272

@@ -91,7 +91,11 @@ public static Optional<Connection> create(
9191
try {
9292
client.ifPresent(HttpClient::close);
9393
} catch (Exception e) {
94-
LOG.log(Level.FINE, "failed to close the http client used to check the reported CDP endpoint: " + reportedUri.get(), e);
94+
LOG.log(
95+
Level.FINE,
96+
"failed to close the http client used to check the reported CDP endpoint: "
97+
+ reportedUri.get(),
98+
e);
9599
}
96100
}
97101
}

java/src/org/openqa/selenium/firefox/FirefoxDriver.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,10 @@ private FirefoxDriver(
159159
Capabilities capabilities = super.getCapabilities();
160160
HttpClient.Factory factory = HttpClient.Factory.createDefault();
161161

162-
Optional<URI> reportedUri = CdpEndpointFinder.getReportedUri("moz:debuggerAddress", capabilities);
163-
Optional<HttpClient> client = reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
162+
Optional<URI> reportedUri =
163+
CdpEndpointFinder.getReportedUri("moz:debuggerAddress", capabilities);
164+
Optional<HttpClient> client =
165+
reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(factory, uri));
164166
Optional<URI> cdpUri;
165167

166168
try {
@@ -177,7 +179,11 @@ private FirefoxDriver(
177179
try {
178180
client.ifPresent(HttpClient::close);
179181
} catch (Exception e) {
180-
LOG.log(Level.FINE, "failed to close the http client used to check the reported CDP endpoint: " + reportedUri.get(), e);
182+
LOG.log(
183+
Level.FINE,
184+
"failed to close the http client used to check the reported CDP endpoint: "
185+
+ reportedUri.get(),
186+
e);
181187
}
182188

183189
Optional<String> webSocketUrl =

java/src/org/openqa/selenium/grid/node/ProxyNodeWebsockets.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ private Optional<Consumer<Message>> findCdpEndpoint(
118118
// Using strings here to avoid Node depending upon specific drivers.
119119
for (String cdpEndpointCap : CDP_ENDPOINT_CAPS) {
120120
Optional<URI> reportedUri = CdpEndpointFinder.getReportedUri(cdpEndpointCap, caps);
121-
Optional<HttpClient> client = reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(clientFactory, uri));
121+
Optional<HttpClient> client =
122+
reportedUri.map(uri -> CdpEndpointFinder.getHttpClient(clientFactory, uri));
122123
Optional<URI> cdpUri;
123124

124125
try {
@@ -139,7 +140,11 @@ private Optional<Consumer<Message>> findCdpEndpoint(
139140
try {
140141
client.ifPresent(HttpClient::close);
141142
} catch (Exception e) {
142-
LOG.log(Level.FINE, "failed to close the http client used to check the reported CDP endpoint: " + reportedUri.get(), e);
143+
LOG.log(
144+
Level.FINE,
145+
"failed to close the http client used to check the reported CDP endpoint: "
146+
+ reportedUri.get(),
147+
e);
143148
}
144149
}
145150
}

0 commit comments

Comments
 (0)