Skip to content

Commit d7fe2c4

Browse files
committed
Remove unnecessary parameter from JsonOutput.write
1 parent 121bb31 commit d7fe2c4

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

java/client/src/org/openqa/selenium/json/JsonOutput.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.io.Closeable;
2323
import java.io.IOException;
2424
import java.io.UncheckedIOException;
25-
import java.lang.reflect.Type;
2625

2726
public class JsonOutput implements Closeable {
2827
private final JsonWriter jsonWriter;
@@ -39,17 +38,17 @@ public void close() throws IOException {
3938
jsonWriter.close();
4039
}
4140

42-
public JsonOutput write(JsonInput input, Type type) {
41+
public JsonOutput write(JsonInput input) {
4342
try {
44-
Object read = input.read(type);
43+
Object read = input.read(Json.OBJECT_TYPE);
4544
jsonWriter.jsonValue(toJson.convert(read));
4645
return this;
4746
} catch (IOException e) {
4847
throw new UncheckedIOException(e);
4948
}
5049
}
5150

52-
public JsonOutput write(Object input, Type type) {
51+
public JsonOutput write(Object input) {
5352
try {
5453
jsonWriter.jsonValue(toJson.convert(input));
5554
return this;

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,22 +229,22 @@ public void writeTo(Appendable appendable) throws IOException {
229229

230230
// Write the first capability we get as the desired capability.
231231
json.name("desiredCapabilities");
232-
json.write(first, MAP_TYPE);
232+
json.write(first);
233233

234234
// And write the first capability for gecko13
235235
json.name("capabilities");
236236
json.beginObject();
237237

238238
json.name("desiredCapabilities");
239-
json.write(first, MAP_TYPE);
239+
json.write(first);
240240

241241
// Then write everything into the w3c payload. Because of the way we do this, it's easiest
242242
// to just populate the "firstMatch" section. The spec says it's fine to omit the
243243
// "alwaysMatch" field, so we do this.
244244
json.name("firstMatch");
245245
json.beginArray();
246246
//noinspection unchecked
247-
getW3C().forEach(map -> json.write(map, MAP_TYPE));
247+
getW3C().forEach(map -> json.write(map));
248248
json.endArray();
249249

250250
json.endObject(); // Close "capabilities" object
@@ -271,7 +271,7 @@ private void writeMetaData(JsonOutput out) throws IOException {
271271

272272
default:
273273
out.name(name);
274-
out.write(input.<Object>read(Object.class), Object.class);
274+
out.write(input.<Object>read(Object.class));
275275
break;
276276
}
277277
}

java/client/test/org/openqa/selenium/remote/internal/HttpClientTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IO
211211
.forEach((key, value) -> {
212212
json.name(key);
213213
json.beginArray();
214-
Stream.of(value).forEach(v -> json.write(v, String.class));
214+
Stream.of(value).forEach(json::write);
215215
json.endArray();
216216
});
217217
json.endObject();

java/server/src/org/openqa/grid/web/servlet/HubStatusServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
9292
try (Writer writer = response.getWriter();
9393
JsonOutput out = json.newOutput(writer)) {
9494
Map<String, Object> res = getResponse(request);
95-
out.write(res, MAP_TYPE);
95+
out.write(res);
9696
}
9797
}
9898

java/server/src/org/openqa/grid/web/servlet/TestSessionStatusServlet.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
7171
response.setStatus(200);
7272
try (Writer writer = response.getWriter();
7373
JsonOutput out = json.newOutput(writer)){
74-
out.write(getResponse(request), MAP_TYPE);
74+
out.write(getResponse(request));
7575
} catch (JsonException e) {
7676
throw new GridException(e.getMessage());
7777
}

0 commit comments

Comments
 (0)