Skip to content

Commit 5b94273

Browse files
authored
[MGPG-141] Remove use of deprecated classes (#117)
The MGPG-138 also updated plexus-utils to 4.0.1 and plexus-xml to 3.0.1. --- https://issues.apache.org/jira/browse/MGPG-141
1 parent afdfd28 commit 5b94273

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
7474
throw new MojoExecutionException("Could not determine gpg version");
7575
}
7676

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

7979
if (args != null) {
8080
for (String arg : args) {

src/main/java/org/apache/maven/plugins/gpg/SignAndDeployFileMojo.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
import java.io.File;
2222
import java.io.FileNotFoundException;
2323
import java.io.IOException;
24-
import java.io.Reader;
25-
import java.io.Writer;
24+
import java.io.InputStream;
25+
import java.io.OutputStream;
2626
import java.nio.file.Files;
2727
import java.util.ArrayList;
2828
import java.util.List;
@@ -46,9 +46,7 @@
4646
import org.apache.maven.plugins.annotations.Parameter;
4747
import org.apache.maven.project.MavenProject;
4848
import org.codehaus.plexus.util.FileUtils;
49-
import org.codehaus.plexus.util.ReaderFactory;
5049
import org.codehaus.plexus.util.StringUtils;
51-
import org.codehaus.plexus.util.WriterFactory;
5250
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
5351
import org.eclipse.aether.RepositorySystem;
5452
import org.eclipse.aether.artifact.Artifact;
@@ -401,8 +399,8 @@ private void processModel(Model model) {
401399
* @throws MojoExecutionException If the file doesn't exist of cannot be read.
402400
*/
403401
private Model readModel(File pomFile) throws MojoExecutionException {
404-
try (Reader reader = ReaderFactory.newXmlReader(pomFile)) {
405-
return new MavenXpp3Reader().read(reader);
402+
try (InputStream inputStream = Files.newInputStream(pomFile.toPath())) {
403+
return new MavenXpp3Reader().read(inputStream);
406404
} catch (FileNotFoundException e) {
407405
throw new MojoExecutionException("POM not found " + pomFile, e);
408406
} catch (IOException e) {
@@ -425,8 +423,8 @@ private File generatePomFile() throws MojoExecutionException {
425423
File tempFile = Files.createTempFile("mvndeploy", ".pom").toFile();
426424
tempFile.deleteOnExit();
427425

428-
try (Writer fw = WriterFactory.newXmlWriter(tempFile)) {
429-
new MavenXpp3Writer().write(fw, model);
426+
try (OutputStream outputStream = Files.newOutputStream(tempFile.toPath())) {
427+
new MavenXpp3Writer().write(outputStream, model);
430428
}
431429

432430
return tempFile;

0 commit comments

Comments
 (0)