From 2aed4a0ec158341a3a78b48d7aeda068b63fdfd7 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Fri, 6 Dec 2024 10:32:21 -0500 Subject: [PATCH] SpecifyUTF-8 when reading build log --- .../org/apache/maven/plugins/invoker/InvokerSession.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java index 9f47c1eb..acf0983d 100644 --- a/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java +++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerSession.java @@ -19,8 +19,10 @@ package org.apache.maven.plugins.invoker; import java.io.File; -import java.io.FileReader; import java.io.IOException; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.ArrayList; import java.util.List; @@ -210,7 +212,7 @@ public void logFailedBuildLog(Log logger, boolean ignoreFailures) throws MojoFai buildLogMessage.append(System.lineSeparator()); buildLogMessage.append("*** begin build.log for: " + buildJob.getProject() + " ***"); buildLogMessage.append(System.lineSeparator()); - try (FileReader buildLogReader = new FileReader(buildLogFile)) { + try (Reader buildLogReader = Files.newBufferedReader(buildLogFile.toPath(), StandardCharsets.UTF_8)) { buildLogMessage.append(IOUtil.toString(buildLogReader)); } buildLogMessage.append("*** end build.log for: " + buildJob.getProject() + " ***");