Skip to content

Commit 0f49c42

Browse files
committed
Get the status servlet working again.
1 parent c15cdbc commit 0f49c42

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.openqa.grid.web.servlet.console.ConsoleServlet;
2424
import org.openqa.selenium.internal.BuildInfo;
2525
import org.openqa.selenium.json.Json;
26+
import org.openqa.selenium.json.JsonOutput;
2627

2728
import java.io.BufferedReader;
2829
import java.io.IOException;
@@ -104,12 +105,17 @@ protected void process(HttpServletRequest request, HttpServletResponse response)
104105
if (in == null) {
105106
response.sendError(HttpServletResponse.SC_NOT_FOUND);
106107
} else {
107-
final String json = new Json().toJson(servletConfig);
108-
final String jsonUtf8 = new String(json.getBytes(), "UTF-8");
108+
StringBuilder jsonBuilder = new StringBuilder();
109+
try (JsonOutput out = new Json().newOutput(jsonBuilder)) {
110+
out.setPrettyPrint(false).write(servletConfig);
111+
}
112+
113+
final String json = jsonBuilder.toString();
114+
109115
final String htmlTemplate =
110116
new BufferedReader(new InputStreamReader(in, "UTF-8")).lines().collect(Collectors.joining("\n"));
111117
final String updatedTemplate =
112-
htmlTemplate.replace(HELPER_SERVLET_TEMPLATE_CONFIG_JSON_VAR, jsonUtf8);
118+
htmlTemplate.replace(HELPER_SERVLET_TEMPLATE_CONFIG_JSON_VAR, json);
113119

114120
response.setContentType("text/html");
115121
response.setCharacterEncoding("UTF-8");

0 commit comments

Comments
 (0)