Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use more modern I/O that does not rely on the system encoding #174

Merged
merged 1 commit into from
Mar 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

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;

import org.apache.maven.model.Model;
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;

/**
Expand Down Expand Up @@ -72,12 +72,11 @@ protected List<MavenProject> 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;
}
}