Skip to content

Commit e3f2586

Browse files
committed
Code clean up: remove dead code, and move to lambdas
1 parent c856444 commit e3f2586

File tree

1 file changed

+3
-26
lines changed

1 file changed

+3
-26
lines changed

java/client/src/org/openqa/selenium/remote/NewSessionPayload.java

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public void writeTo(Appendable appendable) throws IOException {
241241
json.name("firstMatch");
242242
json.beginArray();
243243
//noinspection unchecked
244-
getW3C().forEach(map -> json.write(map));
244+
getW3C().forEach(json::write);
245245
json.endArray();
246246

247247
json.endObject(); // Close "capabilities" object
@@ -275,28 +275,6 @@ private void writeMetaData(JsonOutput out) throws IOException {
275275
}
276276
}
277277

278-
private void streamW3CProtocolParameters(JsonOutput out, Map<String, Object> des) {
279-
// Technically we should be building up a combination of "alwaysMatch" and "firstMatch" options.
280-
// We're going to do a little processing to figure out what we might be able to do, and assume
281-
// that people don't really understand the difference between required and desired (which is
282-
// commonly the case). Wish us luck. Looking at the current implementations, people may have
283-
// set options for multiple browsers, in which case a compliant W3C remote end won't start
284-
// a session. If we find this, then we create multiple firstMatch capabilities. Furrfu.
285-
// The table of options are:
286-
//
287-
// Chrome: chromeOptions
288-
// Firefox: moz:.*, firefox_binary, firefox_profile, marionette
289-
// Edge: none given
290-
// IEDriver: ignoreZoomSetting, initialBrowserUrl, enableElementCacheCleanup,
291-
// browserAttachTimeout, enablePersistentHover, requireWindowFocus, logFile, logLevel, host,
292-
// extractPath, silent, ie.*
293-
// Opera: operaOptions
294-
// SafariDriver: safari.options
295-
//
296-
// We can't use the constants defined in the classes because it would introduce circular
297-
// dependencies between the remote library and the implementations. Yay!
298-
}
299-
300278
/**
301279
* Stream the {@link Capabilities} encoded in the payload used to create this instance. The
302280
* {@link Stream} will start with a {@link Capabilities} object matching the OSS capabilities, and
@@ -388,13 +366,12 @@ private Stream<Map<String, Object>> getW3C() throws IOException {
388366
.map(this::applyTransforms)
389367
.map(map -> map.entrySet().stream()
390368
.filter(entry -> ACCEPTED_W3C_PATTERNS.test(entry.getKey()))
391-
.collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)))
392-
.map(map -> (Map<String, Object>) map);
369+
.collect(ImmutableMap.toImmutableMap(Map.Entry::getKey, Map.Entry::getValue)));
393370
} else {
394371
fromOss = Stream.of();
395372
}
396373

397-
Stream<Map<String, Object>> fromW3c = null;
374+
Stream<Map<String, Object>> fromW3c;
398375
Map<String, Object> alwaysMatch = getAlwaysMatch();
399376
Collection<Map<String, Object>> firsts = getFirstMatches();
400377

0 commit comments

Comments
 (0)