Skip to content
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

MapVariableResolverFactory doesn't check next factory for known variables #357

Open
jdimeo opened this issue Mar 28, 2024 · 0 comments
Open

Comments

@jdimeo
Copy link

jdimeo commented Mar 28, 2024

This method seems to have a bug in the implementation and is doing the exact same thing regardless of the presence of a next factory. Shouldn't the first one recursively check the next factory if this factory doesn't know about the variable?
https://github.com/mvel/mvel/blob/master/src/main/java/org/mvel2/integration/impl/MapVariableResolverFactory.java#L119

This actually seems to be overridding a working implementation in BaseVariableResolverFactory. Maybe we can just remove the subclass's override method entirely.

I'm working around this by making a subclass with this overridden implementation:

@Override
public Set<String> getKnownVariables() {
	var ret = super.getKnownVariables();
	if (getNextFactory() != null) {
		ret.addAll(getNextFactory().getKnownVariables());
	}
	return ret;
}
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

No branches or pull requests

1 participant