Skip to content

Commit 620ab24

Browse files
authored
Merge branch 'trunk' into bidi_add_authentication_handler
2 parents d2fafae + edff2f3 commit 620ab24

File tree

16 files changed

+76
-27
lines changed

16 files changed

+76
-27
lines changed

java/spotbugs-excludes.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,4 +204,30 @@
204204
<Class name="org.openqa.selenium.remote.internal.WebElementToJsonConverter" />
205205
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
206206
</Match>
207+
208+
<Match>
209+
<Class name="org.openqa.selenium.chrome.AddHasCasting" />
210+
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
211+
</Match>
212+
213+
<Match>
214+
<Class name="org.openqa.selenium.chrome.AddHasCdp" />
215+
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
216+
</Match>
217+
218+
<Match>
219+
<Class name="org.openqa.selenium.edge.AddHasCdp" />
220+
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
221+
</Match>
222+
223+
<Match>
224+
<Class name="org.openqa.selenium.edge.AddHasCasting" />
225+
<Bug pattern="NM_SAME_SIMPLE_NAME_AS_SUPERCLASS" />
226+
</Match>
227+
228+
<Match>
229+
<Class name="~org.openqa.selenium.devtools.v[0-9]+\.v\w+" />
230+
<Bug pattern="NM_CLASS_NAMING_CONVENTION"/>
231+
</Match>
232+
207233
</FindBugsFilter>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ public ScriptKey pin(String script) {
212212
// Create the actual script we're going to use.
213213
String scriptToUse =
214214
String.format(
215-
"window.seleniumPinnedScript%s = function(){%s}", Math.abs(script.hashCode()), script);
215+
"window.seleniumPinnedScript%s = function(){%s}",
216+
Math.abs((long) script.hashCode()), script);
216217

217218
DevTools devTools = getDevTools();
218219
devTools.createSessionIfThereIsNotOne();

java/src/org/openqa/selenium/devtools/v127/v127Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedRe
127127
} catch (DevToolsException e) {
128128
// Redirects don't seem to have bodies
129129
int code = pausedReq.getResponseStatusCode().orElse(HTTP_OK);
130-
if (code < 300 && code > 399) {
130+
if (code >= 300 && code <= 399) {
131131
LOG.warning("Unable to get body for request id " + pausedReq.getRequestId());
132132
}
133133

java/src/org/openqa/selenium/devtools/v128/v128Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedRe
127127
} catch (DevToolsException e) {
128128
// Redirects don't seem to have bodies
129129
int code = pausedReq.getResponseStatusCode().orElse(HTTP_OK);
130-
if (code < 300 && code > 399) {
130+
if (code >= 300 && code <= 399) {
131131
LOG.warning("Unable to get body for request id " + pausedReq.getRequestId());
132132
}
133133

java/src/org/openqa/selenium/devtools/v129/v129Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedRe
127127
} catch (DevToolsException e) {
128128
// Redirects don't seem to have bodies
129129
int code = pausedReq.getResponseStatusCode().orElse(HTTP_OK);
130-
if (code < 300 && code > 399) {
130+
if (code >= 300 && code <= 399) {
131131
LOG.warning("Unable to get body for request id " + pausedReq.getRequestId());
132132
}
133133

java/src/org/openqa/selenium/devtools/v85/V85Network.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public Either<HttpRequest, HttpResponse> createSeMessages(RequestPaused pausedRe
137137
} catch (DevToolsException e) {
138138
// Redirects don't seem to have bodies
139139
int code = pausedReq.getResponseStatusCode().orElse(HTTP_OK);
140-
if (code < 300 && code > 399) {
140+
if (code >= 300 && code <= 399) {
141141
LOG.warning("Unable to get body for request id " + pausedReq.getRequestId());
142142
}
143143

java/src/org/openqa/selenium/grid/data/NodeStatus.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ public boolean equals(Object o) {
214214
return Objects.equals(this.nodeId, that.nodeId)
215215
&& Objects.equals(this.externalUri, that.externalUri)
216216
&& this.maxSessionCount == that.maxSessionCount
217+
&& this.sessionTimeout == that.sessionTimeout
217218
&& Objects.equals(this.slots, that.slots)
218219
&& Objects.equals(this.availability, that.availability)
219220
&& Objects.equals(this.version, that.version);
@@ -224,7 +225,7 @@ public int hashCode() {
224225
return Objects.hash(nodeId, externalUri, maxSessionCount, slots, version);
225226
}
226227

227-
private Map<String, Object> toJson() {
228+
public Map<String, Object> toJson() {
228229
Map<String, Object> toReturn = new TreeMap<>();
229230
toReturn.put("nodeId", nodeId);
230231
toReturn.put("externalUri", externalUri);

java/src/org/openqa/selenium/grid/graphql/Grid.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public List<Node> getNodes() {
9797
status.getExternalUri(),
9898
status.getAvailability(),
9999
status.getMaxSessionCount(),
100+
status.getSessionTimeout(),
100101
status.getSlots().size(),
101102
stereotypes,
102103
sessions,

java/src/org/openqa/selenium/grid/graphql/Node.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import com.google.common.collect.ImmutableList;
2121
import java.net.URI;
22+
import java.time.Duration;
2223
import java.util.ArrayList;
2324
import java.util.HashMap;
2425
import java.util.List;
@@ -38,6 +39,7 @@ public class Node {
3839
private final URI uri;
3940
private final Availability status;
4041
private final int maxSession;
42+
private final Duration sessionTimeout;
4143
private final Map<Capabilities, Integer> stereotypes;
4244
private final Map<Session, Slot> activeSessions;
4345
private final String version;
@@ -49,6 +51,7 @@ public Node(
4951
URI uri,
5052
Availability status,
5153
int maxSession,
54+
Duration sessionTimeout,
5255
int slotCount,
5356
Map<Capabilities, Integer> stereotypes,
5457
Map<Session, Slot> activeSessions,
@@ -63,6 +66,7 @@ public Node(
6366
this.activeSessions = Require.nonNull("Active sessions", activeSessions);
6467
this.version = Require.nonNull("Grid Node version", version);
6568
this.osInfo = Require.nonNull("Grid Node OS info", osInfo);
69+
this.sessionTimeout = Require.positive("Node session timeout", sessionTimeout);
6670
}
6771

6872
public List<org.openqa.selenium.grid.graphql.Session> getSessions() {
@@ -122,6 +126,10 @@ public OsInfo getOsInfo() {
122126
return osInfo;
123127
}
124128

129+
public Duration getSessionTimeout() {
130+
return sessionTimeout;
131+
}
132+
125133
private org.openqa.selenium.grid.graphql.Session createGraphqlSession(
126134
Map.Entry<Session, Slot> entry) {
127135
Session session = entry.getKey();

java/src/org/openqa/selenium/grid/graphql/selenium-grid-schema.graphqls

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ type Node {
3838
uri: Uri!
3939
status: Status!
4040
maxSession: Int!
41+
sessionTimeout: String!
4142
slotCount: Int!
4243
sessions: [Session]!
4344
sessionCount: Int!

0 commit comments

Comments
 (0)