Cleanup description new-lines for launch script

Replace all new-line characters in multi-line pom descriptions before
inserting into the launcher script. Prior to this commit the shell would
attempt to execut the extra lines, for example:

	<description>
		A multi-line pom description that could do something terrible:
		rm -r foo
	</description>

Closes gh-4703
This commit is contained in:
Robert Thornton 2015-12-07 17:15:10 -07:00 committed by Phillip Webb
parent a3a320d97b
commit 8e0b8750c0

View File

@ -261,11 +261,16 @@ public class RepackageMojo extends AbstractDependencyFilterMojo {
putIfMissing(properties, "initInfoProvides", this.project.getArtifactId());
putIfMissing(properties, "initInfoShortDescription", this.project.getName(),
this.project.getArtifactId());
putIfMissing(properties, "initInfoDescription", this.project.getDescription(),
this.project.getName(), this.project.getArtifactId());
putIfMissing(properties, "initInfoDescription",
removeLineBreaks(this.project.getDescription()), this.project.getName(),
this.project.getArtifactId());
return properties;
}
private String removeLineBreaks(String description) {
return description.replaceAll("\\s+", " ");
}
private void putIfMissing(Properties properties, String key,
String... valueCandidates) {
if (!properties.containsKey(key)) {