From 84f5877c3946995993c831e548987eda01058c7b Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Thu, 16 Mar 2023 07:15:05 -0400 Subject: [PATCH] use more modern I/O that does not rely on the system encoding --- .../phase/AbstractBackupPomsPhaseTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java index ad0e863d..43648bb4 100644 --- a/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java +++ b/maven-release-manager/src/test/java/org/apache/maven/shared/release/phase/AbstractBackupPomsPhaseTest.java @@ -20,6 +20,8 @@ import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; import java.util.ArrayList; import java.util.List; @@ -27,8 +29,6 @@ import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.release.PlexusJUnit4TestCase; -import org.codehaus.plexus.util.ReaderFactory; -import org.codehaus.plexus.util.xml.XmlStreamReader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; /** @@ -72,12 +72,11 @@ protected List getReactorProjects(String projectPath) throws Excep private MavenProject createMavenProject(File pomFile) throws IOException, XmlPullParserException { MavenXpp3Reader reader = new MavenXpp3Reader(); - Model model; - try (XmlStreamReader xmlStreamReader = ReaderFactory.newXmlReader(pomFile)) { - model = reader.read(xmlStreamReader); + try (InputStream in = Files.newInputStream(pomFile.toPath())) { + Model model = reader.read(in); + MavenProject project = new MavenProject(model); + project.setFile(pomFile); + return project; } - MavenProject project = new MavenProject(model); - project.setFile(pomFile); - return project; } }