Skip to content

Commit

Permalink
[MGPG-141] Remove use of deprecated classes (#117)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cstamas authored Sep 10, 2024
1 parent afdfd28 commit 5b94273
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
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

0 comments on commit 5b94273

Please # to comment.