Skip to content

Commit

Permalink
[FIX JENKINS-14899] Don't use truncating LargeText for /consoleText
Browse files Browse the repository at this point in the history
(cherry picked from commit 20bd4e3)
  • Loading branch information
daniel-beck authored and olivergondza committed Jul 7, 2015
1 parent 0fcb588 commit c3dcaeb
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions core/src/main/java/hudson/model/Run.java
Expand Up @@ -39,10 +39,7 @@
import hudson.Util; import hudson.Util;
import hudson.XmlFile; import hudson.XmlFile;
import hudson.cli.declarative.CLIMethod; import hudson.cli.declarative.CLIMethod;
import hudson.console.AnnotatedLargeText; import hudson.console.*;
import hudson.console.ConsoleLogFilter;
import hudson.console.ConsoleNote;
import hudson.console.ModelHyperlinkNote;
import hudson.model.Descriptor.FormException; import hudson.model.Descriptor.FormException;
import hudson.model.Run.RunExecution; import hudson.model.Run.RunExecution;
import hudson.model.listeners.RunListener; import hudson.model.listeners.RunListener;
Expand Down Expand Up @@ -2086,19 +2083,13 @@ public void doBuildTimestamp( StaplerRequest req, StaplerResponse rsp, @QueryPar
*/ */
public void doConsoleText(StaplerRequest req, StaplerResponse rsp) throws IOException { public void doConsoleText(StaplerRequest req, StaplerResponse rsp) throws IOException {
rsp.setContentType("text/plain;charset=UTF-8"); rsp.setContentType("text/plain;charset=UTF-8");
// Prevent jelly from flushing stream so Content-Length header can be added afterwards PlainTextConsoleOutputStream out = new PlainTextConsoleOutputStream(rsp.getCompressedOutputStream(req));
FlushProofOutputStream out = new FlushProofOutputStream(rsp.getCompressedOutputStream(req)); InputStream input = getLogInputStream();
try{ try {
getLogText().writeLogTo(0,out); IOUtils.copy(input, out);
} catch (IOException e) { out.flush();
// see comment in writeLogTo() method } finally {
InputStream input = getLogInputStream(); IOUtils.closeQuietly(input);
try {
IOUtils.copy(input, out);
} finally {
IOUtils.closeQuietly(input);
}
} finally {
IOUtils.closeQuietly(out); IOUtils.closeQuietly(out);
} }
} }
Expand Down

0 comments on commit c3dcaeb

Please sign in to comment.