diff --git a/pom.xml b/pom.xml index 67122e06..3ad75ce1 100644 --- a/pom.xml +++ b/pom.xml @@ -127,6 +127,17 @@ 2021-03-01T20:31:11Z + + + + + commons-io + commons-io + 2.11.0 + + + + diff --git a/src/test/java/org/codehaus/mojo/flatten/KeepCommentsInPomTest.java b/src/test/java/org/codehaus/mojo/flatten/KeepCommentsInPomTest.java index 702ad5ec..ff17efbc 100644 --- a/src/test/java/org/codehaus/mojo/flatten/KeepCommentsInPomTest.java +++ b/src/test/java/org/codehaus/mojo/flatten/KeepCommentsInPomTest.java @@ -20,11 +20,11 @@ */ import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; -import org.apache.commons.io.IOUtils; import org.apache.maven.plugin.testing.MojoRule; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.configuration.DefaultPlexusConfiguration; @@ -112,14 +112,7 @@ private boolean isJdk8() */ private String getContent( String aPomFile ) throws IOException { - String tempString; - try ( InputStream tempIn = new FileInputStream( aPomFile ) ) - { - tempString = IOUtils.toString( tempIn ); - } - // remove platform dependent CR/LF - tempString = tempString.replaceAll( "\r\n", "\n" ); - return tempString; + return String.join( "\n", Files.readAllLines( Paths.get( aPomFile ), StandardCharsets.UTF_8 ) ); } }