diff --git a/core/src/main/java/hudson/console/ConsoleNote.java b/core/src/main/java/hudson/console/ConsoleNote.java
index 633a5ed54743..0dc24256d5e0 100644
--- a/core/src/main/java/hudson/console/ConsoleNote.java
+++ b/core/src/main/java/hudson/console/ConsoleNote.java
@@ -194,7 +194,7 @@ public void encodeTo(OutputStream out) throws IOException {
* encoding is ASCII compatible.
*/
public void encodeTo(Writer out) throws IOException {
- out.write(encodeToBytes().toString());
+ out.write(encodeToBytes().toString(StandardCharsets.UTF_8));
}
private ByteArrayOutputStream encodeToBytes() throws IOException {
@@ -224,7 +224,7 @@ private ByteArrayOutputStream encodeToBytes() throws IOException {
* Works like {@link #encodeTo(Writer)} but obtain the result as a string.
*/
public String encode() throws IOException {
- return encodeToBytes().toString();
+ return encodeToBytes().toString(StandardCharsets.UTF_8);
}
/**
diff --git a/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java b/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
index 2cf936679a68..7f6bf0053b3f 100644
--- a/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
+++ b/core/src/main/java/hudson/lifecycle/WindowsServiceLifecycle.java
@@ -38,6 +38,7 @@
import java.io.Writer;
import java.net.URL;
import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
import java.util.logging.Level;
@@ -145,7 +146,7 @@ public void restart() throws IOException, InterruptedException {
int r = new LocalLauncher(task).launch().cmds(executable, "restart!")
.stdout(task).pwd(home).join();
if (r != 0)
- throw new IOException(baos.toString());
+ throw new IOException(baos.toString(StandardCharsets.UTF_8));
}
private static File getBaseDir() {
diff --git a/core/src/main/java/hudson/util/TextFile.java b/core/src/main/java/hudson/util/TextFile.java
index 89ab731c6afc..fece5cf80d15 100644
--- a/core/src/main/java/hudson/util/TextFile.java
+++ b/core/src/main/java/hudson/util/TextFile.java
@@ -28,7 +28,6 @@
import hudson.Util;
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.RandomAccessFile;
@@ -114,7 +113,7 @@ public void write(String text) throws IOException {
public @NonNull String head(int numChars) throws IOException {
char[] buf = new char[numChars];
int read = 0;
- try (Reader r = new FileReader(file)) {
+ try (Reader r = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) {
while (read < numChars) {
int d = r.read(buf, read, buf.length - read);
if (d < 0)
diff --git a/core/src/spotbugs/excludesFilter.xml b/core/src/spotbugs/excludesFilter.xml
index 7d36952fc372..15a8335d2c5d 100644
--- a/core/src/spotbugs/excludesFilter.xml
+++ b/core/src/spotbugs/excludesFilter.xml
@@ -180,16 +180,6 @@
this section.
- If it is not a false positive, fix the bug, then remove the exclusion from this section.
-->
-
-
-
-
-
-
-
-
-
-