[MAGNOLIA-4134] Method inPublicMode() in ModeDependentRenderExceptionHandler is never called Created: 19/Mar/12  Updated: 16/May/17  Resolved: 07/Apr/17

Status: Closed
Project: Magnolia
Component/s: rendering
Affects Version/s: 4.5, 4.5.1
Fix Version/s: 5.4.12, 5.5.4

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

Issue Links:
causality
caused by MAGNOLIA-4339 rendering: improve exception handling Closed
relation
is related to MAGNOLIA-3242 Make FreeMarker's TemplateExceptionHa... Closed
is related to MAGNOLIA-6637 Remove use of deprecated class in con... Closed
supersession
supersedes MAGNOLIA-6692 Freemarker.runtime errors are not ren... 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
Date of First Response:
Sprint: Basel 88, Basel 90
Story Points: 2

 Description   

The method inPublicMode() in ModeDependentRenderExceptionHandler is never called and ModeDependentTemplateExceptionHandler should not be deprecated because it's a key part of how the mechanism works.

When a freemarker template fails this is what happens:

Freemarker logs the exception always
It will then call the TemplateExceptionHandler to let it decide what to do
We use ModeDependentTemplateExceptionHandler which does different things depending on whether the instance is an admin or a public
For a public: it does nothing
For an author: it writes the exception to the output stream and then throws a TemplateException
A thrown exception gets passed to ModeDependentRenderExceptionHandler which again tests if the instance is an author or a public
For a public it will log the exception, but this code is never reached, see above
For an author it will log the exception a second time and write the exception to the output stream again (without the trace and with more details)
Note, that the error mechanism is the same for all freemarker rendering, not just the cms rendering. The user interface also uses the freemarker support, for instance the module manager ui and many gui controls, as well as the rendering of templates for email.



 Comments   
Comment by Espen Jervidalo [ 27/Mar/17 ]

had There are around 5 related and completely bogus tickets around this topic. I tried to summarize the mess here: https://jira.magnolia-cms.com/browse/MAGNOLIA-6692?focusedCommentId=140515&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-140515

Conclusion:

So far my feeling is that, before fixing anything else of this ping-pong-maniac I would verify and tackle MAGNOLIA-4134.
And block all related tickets until we know what to do.

So, this one should not have been blocked, but verified properly.

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