Skip to content
New issue

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

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

Already on GitHub? # to your account

[MGPG-141] Remove use of deprecated classes #117

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
throw new MojoExecutionException("Could not determine gpg version");
}

getLog().debug(gpgVersion.toString());
getLog().debug("GPG Version: " + gpgVersion);

if (args != null) {
for (String arg : args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
Expand All @@ -46,9 +46,7 @@
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.artifact.Artifact;
Expand Down Expand Up @@ -401,8 +399,8 @@ private void processModel(Model model) {
* @throws MojoExecutionException If the file doesn't exist of cannot be read.
*/
private Model readModel(File pomFile) throws MojoExecutionException {
try (Reader reader = ReaderFactory.newXmlReader(pomFile)) {
return new MavenXpp3Reader().read(reader);
try (InputStream inputStream = Files.newInputStream(pomFile.toPath())) {
return new MavenXpp3Reader().read(inputStream);
} catch (FileNotFoundException e) {
throw new MojoExecutionException("POM not found " + pomFile, e);
} catch (IOException e) {
Expand All @@ -425,8 +423,8 @@ private File generatePomFile() throws MojoExecutionException {
File tempFile = Files.createTempFile("mvndeploy", ".pom").toFile();
tempFile.deleteOnExit();

try (Writer fw = WriterFactory.newXmlWriter(tempFile)) {
new MavenXpp3Writer().write(fw, model);
try (OutputStream outputStream = Files.newOutputStream(tempFile.toPath())) {
new MavenXpp3Writer().write(outputStream, model);
}

return tempFile;
Expand Down