Fixed the charset encoding handling when different encodings are involved between the master and slaves.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21664 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2009-09-14 23:52:25 +00:00
1 parent 73f1b2ebac
commit 8a73c25000
1 file changed
+6 -4
+6 -4
View File
@@ -899,14 +899,16 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
public Reader getLogReader() throws IOException {
File logFile = getLogFile();
if (logFile.exists() ) {
return new FileReader(logFile);
if (charset==null) return new FileReader(logFile); // fall back
return new InputStreamReader(new FileInputStream(logFile),charset);
}
File compressedLogFile = new File(logFile.getParentFile(), logFile.getName()+ ".gz");
if (compressedLogFile.exists()) {
return new InputStreamReader(
new GZIPInputStream(
new FileInputStream(compressedLogFile)));
GZIPInputStream is = new GZIPInputStream(new FileInputStream(compressedLogFile));
if (charset==null) return new InputStreamReader(is);
else return new InputStreamReader(is,charset);
}
return null;