[MAGNOLIA-3190] Freemarker: incomplete configuration of sharedVariables results in StackOverflowError Created: 03/May/10  Updated: 23/Jan/13  Resolved: 03/May/10

Status: Closed
Project: Magnolia
Component/s: freemarker
Affects Version/s: 4.3.1
Fix Version/s: 4.3.2

Type: Bug Priority: Major
Reporter: Magnolia International Assignee: Magnolia International
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MAGNOLIA-3087 Allow configuration of shared variabl... Closed
caused by MAGNOLIA-3080 Cleanup conundrum between FreemarkerH... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

While configuring /server/rendering/freemarker/sharedVariables, one can enter an endless loop, quickly resulting in a StackOverflowError; this happens, for instance, when adding a node under sharedVariables, and not filling it in it with a class attribute. The error only shows up on startup, so if the configuration is complete and correct before restarting Magnolia, one should be safe.

The reason this happens is because FreemarkerConfig#addSharedVariable needs an instance of ObjectWrapper, and in turns, our MagnoliaObjectWrapper needs an instance of FreemarkerConfig, which it gets via Components Since Content2Bean calls addSharedVariable() before FreemarkerConfig is registered in Components, this results in a stack overflow.


Generated at Mon Feb 12 03:44:04 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.