diff --git a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java index 974239a94e..6ab8b56d10 100644 --- a/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java +++ b/versions-common/src/main/java/org/codehaus/mojo/versions/api/PomHelper.java @@ -1364,9 +1364,7 @@ private static List getRawModelTree(ModelNode rootNode, Log logger, X .map(pomFile -> { try { ModifiedPomXMLEventReader pom = new ModifiedPomXMLEventReader( - new StringBuilder(new String(Files.readAllBytes(pomFile))), - inputFactory, - pomFile.toString()); + readXmlFile(pomFile.toFile()), inputFactory, pomFile.toString()); return new ModelNode(rootNode, getRawModel(pom), pom); } catch (IOException e) { throw new UncheckedIOException("Could not open " + pomFile, e); diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/invoker.properties b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/invoker.properties new file mode 100644 index 0000000000..eea1477f0e --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:use-dep-version +invoker.mavenOpts = -Dfile.encoding=latin1 -Dincludes=localhost -DdepVersion=1.0.1 diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/pom.xml b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/pom.xml new file mode 100644 index 0000000000..4ce5ded45c --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + test-group + test-artifact + DEVELOP-SNAPSHOT + + Wörter mit Umlauten + + + + + localhost + dummy-api + 1.0 + + + diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/verify.groovy b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/verify.groovy new file mode 100644 index 0000000000..a057a3c630 --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts-iso8859-1/verify.groovy @@ -0,0 +1,5 @@ +import groovy.xml.XmlSlurper + +def project = new XmlSlurper().parse( new File( basedir, 'pom.xml' ) ) +assert project.dependencies.dependency.version == '1.0.1' +assert project.description == 'Wörter mit Umlauten' diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/invoker.properties b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/invoker.properties new file mode 100644 index 0000000000..eea1477f0e --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:use-dep-version +invoker.mavenOpts = -Dfile.encoding=latin1 -Dincludes=localhost -DdepVersion=1.0.1 diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/pom.xml b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/pom.xml new file mode 100644 index 0000000000..76e36d2fd9 --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/pom.xml @@ -0,0 +1,19 @@ + + + 4.0.0 + + test-group + test-artifact + DEVELOP-SNAPSHOT + + Wörter mit Umlauten + + + + + localhost + dummy-api + 1.0 + + + diff --git a/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/verify.groovy b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/verify.groovy new file mode 100644 index 0000000000..a057a3c630 --- /dev/null +++ b/versions-maven-plugin/src/it/it-use-dep-version-issue-931-umlauts/verify.groovy @@ -0,0 +1,5 @@ +import groovy.xml.XmlSlurper + +def project = new XmlSlurper().parse( new File( basedir, 'pom.xml' ) ) +assert project.dependencies.dependency.version == '1.0.1' +assert project.description == 'Wörter mit Umlauten' diff --git a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java index 6a8e35f4fd..33b47ed3c5 100644 --- a/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java +++ b/versions-maven-plugin/src/main/java/org/codehaus/mojo/versions/UseDepVersionMojo.java @@ -20,7 +20,6 @@ import java.io.File; import java.io.IOException; -import java.nio.file.Files; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -136,10 +135,10 @@ protected void update(ModifiedPomXMLEventReader pom) public void execute() throws MojoExecutionException, MojoFailureException { validateInput(); List rawModels; + try { ModifiedPomXMLEventReader pomReader = newModifiedPomXER( - new StringBuilder( - new String(Files.readAllBytes(getProject().getFile().toPath()))), + PomHelper.readXmlFile(getProject().getFile()), getProject().getFile().toPath().toString()); ModelNode rootNode = new ModelNode(PomHelper.getRawModel(pomReader), pomReader); rawModels = PomHelper.getRawModelTree(rootNode, getLog());