You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/02/24 18:56:08 UTC
[maven-plugin-tools] 01/01: [MPLUGIN-394] use XmlStreamReader to detect encoding instead of platform
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch MPLUGIN-394
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git
commit 2448ca47d3ea6888a9ebe7b58fbbf6fa1b0a1f0d
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Thu Feb 24 19:55:56 2022 +0100
[MPLUGIN-394] use XmlStreamReader to detect encoding instead of platform
---
.../java/org/apache/maven/plugin/plugin/PluginReport.java | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
index 95f7381..4705c26 100644
--- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
+++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java
@@ -20,8 +20,9 @@ package org.apache.maven.plugin.plugin;
*/
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -62,6 +63,7 @@ import org.apache.maven.tools.plugin.util.PluginUtils;
import org.codehaus.plexus.component.repository.ComponentDependency;
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
import org.codehaus.plexus.util.xml.Xpp3Dom;
/**
@@ -273,11 +275,11 @@ public class PluginReport
{
PluginDescriptorBuilder builder = getPluginDescriptorBuilder();
- try
+ try ( InputStream in = new FileInputStream( pluginXmlFile ) )
{
- return builder.build( new FileReader( pluginXmlFile ) );
+ return builder.build( new XmlStreamReader( in ) );
}
- catch ( FileNotFoundException | PlexusConfigurationException e )
+ catch ( IOException | PlexusConfigurationException e )
{
getLog().debug( "Failed to read " + pluginXmlFile + ", fall back to mojoScanner" );
}