templating: new directives (MAGNOLIA-4151)

[MAGNOLIA-4171] templating: Registration of Directives does not work Created: 26/Apr/11  Updated: 22/Mar/12  Resolved: 26/Apr/11

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: 4.5

Type: Sub-task Priority: Critical
Reporter: Daniel Lipp Assignee: Daniel Lipp
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Date of First Response:

 Description   

When trying to register the new Directives we get the following Content2Bean Exception:
ERROR olia.content2bean.impl.Content2BeanTransformerImpl: Can't set property [sharedVariables] to value ...

It looks like for any reason the wrong FreemarkerConfig#addSharedVariable is called (not the one with params String, Object but with String, TemplateModel.

This already happens in 4.4 branch so it's actually not clear what change introduced it.



 Comments   
Comment by Magnolia International [ 25/Aug/11 ]

For the record: this was never changed, but what likely happened is: content2bean looks for a matching "add" method. It finds the first one (addSharedVariable(String name, Object value) and is content with it. Obviously this highly depends on the order of the methods, i.e depends on how the code was compiled. In most cases, it seems the source order is kept, but probably when hot deploying classes, this order can change.

Reported this as MAGNOLIA-3811 and applied fix on 4.4 branch as well.

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