diff --git a/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java index 9fab222d..3feab0d1 100644 --- a/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/pmd/CpdViolationCheckMojo.java @@ -20,8 +20,9 @@ */ import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.util.List; import org.apache.maven.plugin.MojoExecutionException; @@ -114,13 +115,12 @@ protected void printError( Duplication item, String severity ) * {@inheritDoc} */ @Override - protected List getErrorDetails( File cpdFile ) - throws XmlPullParserException, IOException + protected List getErrorDetails( File cpdFile ) throws XmlPullParserException, IOException { - try ( FileReader fileReader = new FileReader( cpdFile ) ) + try ( InputStream in = new FileInputStream( cpdFile ) ) { CpdXpp3Reader reader = new CpdXpp3Reader(); - CpdErrorDetail details = reader.read( fileReader, false ); + CpdErrorDetail details = reader.read( in, false ); return details.getDuplications(); } } diff --git a/src/main/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojo.java b/src/main/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojo.java index 8ff7e623..39cb7ef2 100644 --- a/src/main/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojo.java +++ b/src/main/java/org/apache/maven/plugins/pmd/PmdViolationCheckMojo.java @@ -20,8 +20,9 @@ */ import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; @@ -124,14 +125,12 @@ protected void printError( Violation item, String severity ) } @Override - protected List getErrorDetails( File pmdFile ) - throws XmlPullParserException, IOException + protected List getErrorDetails( File pmdFile ) throws XmlPullParserException, IOException { - try ( FileReader reader1 = new FileReader( pmdFile ) ) + try ( InputStream in = new FileInputStream( pmdFile ) ) { PmdXpp3Reader reader = new PmdXpp3Reader(); - PmdErrorDetail details = reader.read( reader1, false ); - + PmdErrorDetail details = reader.read( in, false ); List violations = new ArrayList<>(); for ( PmdFile file : details.getFiles() ) {