Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
reckart opened this issue Jul 15, 2022 · 1 comment · Fixed by #5321
Assignees
Milestone

Comments

@reckart
Copy link
Contributor

reckart commented Jul 15, 2022

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

@reckart
Copy link
Contributor Author

reckart commented Sep 1, 2022

@bjhargrave It would be great to have a 6.3.2 or 6.4.0 release which includes this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants