Skip to content

MustacheEnvironmentCollector with nullValue compiler option no longer works in version 2.3.1 #22039

Closed
@ebussieres

Description

@ebussieres

I've found a regression that is caused by #21060, Everything works with version 2.3.0 and it no longer works with version 2.3.1.

If you define the nullValue compiler option in mustache, it no longer works and throw an exception telling that the field is not found:

Caused by: com.samskivert.mustache.MustacheException$Context: No method or field with name 'model.id' on line 7`
        @Bean
	public Mustache.Compiler mustacheCompiler(TemplateLoader mustacheTemplateLoader,
																						Environment environment) {
		return Mustache.compiler()
						.nullValue("")
						.withLoader(mustacheTemplateLoader)
						.withCollector(collector(environment));
	}

	private Mustache.Collector collector(Environment environment) {
		MustacheEnvironmentCollector collector = new MustacheEnvironmentCollector();
		collector.setEnvironment(environment);
		return collector;
	}

I've made a simple project with a test case to demonstrate it. It can be found here. https://github.com/ebussieres/regression-21060

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions