[MGNLSTK-727] Freemarker exception for demo-project when accessing as external user Created: 16/Dec/10  Updated: 19/Jan/11  Resolved: 18/Jan/11

Status: Closed
Project: Magnolia Standard Templating Kit (closed)
Component/s: demoproject
Affects Version/s: 1.4.1
Fix Version/s: 1.4.2

Type: Bug Priority: Neutral
Reporter: Zdenek Skodik Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File screenshot.png     Text File stacktrace.txt    
Issue Links:
relation
is related to MGNLSTK-568 Revert MGNLSTK-533 for 1.3 Closed
is related to MGNLSTK-533 pur integration in templating kit bre... Closed
is related to MAGNOLIA-3037 Handle UnsupportedOperationException ... Closed
supersession
is superseded by MAGNOLIA-3472 Also handle UnsupportedOperationExcep... Closed
Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

Rendering whatever demo site by a ldap user results in attached freemarker exception for templating-kit/paragraphs/pur/link.ftl. The problematic instruction is:

userFullName=ctx.user.getProperty("title")!userName

It's a continuous story of MGNLSTK-533 & MGNLSTK-568 & MAGNOLIA-3037.

As a temporary workaround you can edit the script and bypass retrieving the problematic property by assigning (the fallback) userName directly to userFullName.



 Comments   
Comment by Magnolia International [ 17/Dec/10 ]

When fixing MAGNOLIA-3037, i wrote a test: http://svn.magnolia-cms.com/view/community/magnolia/trunk/magnolia-core/src/test/java/info/magnolia/freemarker/FreemarkerHelperTest.java?p2=%2Fcommunity%2Fmagnolia%2Ftrunk%2Fmagnolia-core%2Fsrc%2Ftest%2Fjava%2Finfo%2Fmagnolia%2Ffreemarker%2FFreemarkerHelperTest.java&p1=%2Fcommunity%2Fmagnolia%2Ftrunk%2Fmagnolia-core%2Fsrc%2Ftest%2Fjava%2Finfo%2Fmagnolia%2Ffreemarker%2FFreemarkerHelperTest.java&r1=31275&r2=31274&view=diff&pathrev=31275

If this test still passes, I have to admit I .. don't get it.

Comment by Magnolia International [ 17/Dec/10 ]

Okay, testing on a 4.4.1 bundle + ldap, I can confirm this happens, although I don't see the exception on screen.

Comment by Magnolia International [ 17/Dec/10 ]

Finally figured out what was going on !
The info.magnolia.freemarker.models.UserModel is written to "hide" the UnsupportedOperationException only when using user.fullName - which gets interpreted as user.getProperty("fullName").
Our template still do user.getProperty("fullName"), and that falls out of the try/catch block of UserModel.

Comment by Magnolia International [ 17/Dec/10 ]

Reopening, needs an update task for the template.

Comment by Federico Grilli [ 18/Jan/11 ]

Actually we don't need an update task for this as templates are automatically overwritten when the "Update template during upgrades automatically" option is checked.

Generated at Mon Feb 12 07:29:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.