Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
[FIXED JENKINS-17657] Get valid encoding from EncodingValidator.
  • Loading branch information
uhafner committed Apr 29, 2013
1 parent 928d541 commit 70a24268cdca3ba50fe47d0c760c199cd38790e1
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/main/java/hudson/plugins/analysis/core/HealthAwareRecorder.java
@@ -1,4 +1,4 @@
package hudson.plugins.analysis.core;
package hudson.plugins.analysis.core; // NOPMD

import java.io.File;
import java.io.FileNotFoundException;
@@ -7,6 +7,8 @@
import java.io.PrintStream;
import java.util.Collection;

import javax.annotation.CheckForNull;

import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;

@@ -440,7 +442,7 @@ private void logExceptionToFile(final IOException exception, final File masterFi
print(outputStream,
"If you are building on the master: please check if the file is accessible under '$JENKINS_HOME/[job-name]/workspace/%s'%n",
slaveFileName);
exception.printStackTrace(new PrintStream(outputStream, false, getDefaultEncoding()));
exception.printStackTrace(new PrintStream(outputStream, false, getEncoding()));
}
catch (IOException error) {
// ignore
@@ -452,7 +454,11 @@ private void logExceptionToFile(final IOException exception, final File masterFi

private void print(final FileOutputStream outputStream, final String message,
final Object... arguments) throws IOException {
IOUtils.write(String.format(message, arguments), outputStream, EncodingValidator.getEncoding(getDefaultEncoding()));
IOUtils.write(String.format(message, arguments), outputStream, getEncoding());
}

private String getEncoding() {
return EncodingValidator.getEncoding(getDefaultEncoding());
}

/**
@@ -566,6 +572,7 @@ public String getUnHealthy() {
*
* @return the default encoding
*/
@CheckForNull
public String getDefaultEncoding() {
return defaultEncoding;
}

0 comments on commit 70a2426

Please sign in to comment.