Skip to content

Commit bf9bcb5

Browse files
committed
Don't use string writer and buffer in memory
1 parent 5f1f92d commit bf9bcb5

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main/java/io/jenkins/plugins/pipelinegraphview/consoleview/PipelineConsoleViewAction.java

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,20 +121,23 @@ protected JSONObject getAllSteps() throws IOException {
121121
}
122122

123123
@WebMethod(name = "log")
124-
public HttpResponse getConsoleText(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
124+
public void getConsoleText(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException {
125125
String nodeId = req.getParameter("nodeId");
126126
if (nodeId == null) {
127127
logger.error("'consoleText' was not passed 'nodeId'.");
128-
return HttpResponses.errorJSON("Error getting console text");
128+
rsp.getWriter().write("Error getting console text");
129+
return;
129130
}
130131
logger.debug("getConsoleText was passed node id '{}'.", nodeId);
131132
// This will be a step, so return its log output.
132133
AnnotatedLargeText<? extends FlowNode> logText = getLogForNode(nodeId);
133134

135+
134136
if (logText != null) {
135-
return HttpResponses.text(PipelineNodeUtil.convertLogToString(logText));
137+
logText.writeLogTo(0L, rsp.getOutputStream());
138+
return;
136139
}
137-
return HttpResponses.text("No logs found");
140+
rsp.getWriter().write("No logs found");
138141
}
139142

140143
/*

0 commit comments

Comments
 (0)