Skip to content

Stack overflow error in aQute.maven.provider.POM when macro contains ${project.parent.version} and no parent is available #5318

@reckart

Description

@reckart

There is a stack overflow bug in the code of aQute.maven.provider.POM which triggers when a property contains a value likeFOO-${project.parent.version} but no parent can be found.

In this case, the POM code puts a message into the properties map:

if (parent.revision != null) {
	...
} else {
	String parentVersionString = "parent version from " + revision + " but not parent?";
	properties.put("project.parent.version", parentVersionString);
	properties.put("parent.version", parentVersionString);
}

This message contains the original property, so the result will be parent version from FOO-${project.parent.version} but not parent?.

Later, when POM.replaceMacros() is called, this embedding of the ${project.parent.version} in the property value causes an infinite recursion because the message that is the macro replacement always contains again the macro itself:

private String replaceMacros(String value) {
	...
	if (property != null && property.indexOf('$') >= 0) {
		property = replaceMacros(property);
	}
	...
}

Observed in bnd 6.3.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions