mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-10-26 19:15:09 +00:00
Fix DM_DEFAULT_ENCODING SpotBugs violations (#6050)
This commit is contained in:
1 parent
a5f13e65ef
commit
8a5e309256
29 files changed
+108
-82
No files matched your search
@@ -86,6 +86,7 @@ import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.file.FileSystemException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
@@ -2279,7 +2280,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Override
|
||||
public String invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
|
||||
return new String(Files.readAllBytes(fileToPath(f)));
|
||||
return new String(Files.readAllBytes(fileToPath(f)), Charset.defaultCharset());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2336,7 +2337,7 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
||||
mkdirs(f.getParentFile());
|
||||
try (OutputStream fos = Files.newOutputStream(fileToPath(f));
|
||||
Writer w = encoding != null ? new OutputStreamWriter(fos, encoding) : new OutputStreamWriter(fos)) {
|
||||
Writer w = encoding != null ? new OutputStreamWriter(fos, encoding) : new OutputStreamWriter(fos, Charset.defaultCharset())) {
|
||||
w.write(content);
|
||||
}
|
||||
return null;
|
||||
@@ -3611,5 +3612,4 @@ public final class FilePath implements SerializableOnlyOverRemoting {
|
||||
}
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user