File tree Expand file tree Collapse file tree 1 file changed +27
-2
lines changed
src/main/java/org/openqa/selenium/remote Expand file tree Collapse file tree 1 file changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -219,8 +219,7 @@ public void writeTo(Appendable appendable) throws IOException {
219219
220220 Map <String , Object > first = getOss ();
221221 if (first == null ) {
222- //noinspection unchecked
223- first = (Map <String , Object >) stream ().findFirst ()
222+ first = stream ().findFirst ()
224223 .orElse (new ImmutableCapabilities ())
225224 .asMap ();
226225 }
@@ -246,10 +245,36 @@ public void writeTo(Appendable appendable) throws IOException {
246245 json .endArray ();
247246
248247 json .endObject (); // Close "capabilities" object
248+
249+ writeMetaData (json );
250+
249251 json .endObject ();
250252 }
251253 }
252254
255+ private void writeMetaData (JsonOutput out ) throws IOException {
256+ CharSource charSource = backingStore .asByteSource ().asCharSource (UTF_8 );
257+ try (Reader reader = charSource .openBufferedStream ();
258+ JsonInput input = json .newInput (reader )) {
259+ input .beginObject ();
260+ while (input .hasNext ()) {
261+ String name = input .nextName ();
262+ switch (name ) {
263+ case "capabilities" :
264+ case "desiredCapabilities" :
265+ case "requiredCapabilities" :
266+ input .skipValue ();
267+ break ;
268+
269+ default :
270+ out .name (name );
271+ out .write (input .<Object >read (Object .class ), Object .class );
272+ break ;
273+ }
274+ }
275+ }
276+ }
277+
253278 private void streamW3CProtocolParameters (JsonOutput out , Map <String , Object > des ) {
254279 // Technically we should be building up a combination of "alwaysMatch" and "firstMatch" options.
255280 // We're going to do a little processing to figure out what we might be able to do, and assume
You can’t perform that action at this time.
0 commit comments