[MGNLSTK-788] Ugly freemarker exception when no theme is selected Created: 04/Aug/11  Updated: 04/Nov/15  Resolved: 04/Nov/15

Status: Closed
Project: Magnolia Standard Templating Kit (closed)
Component/s: None
Affects Version/s: 1.4.4
Fix Version/s: 1.4.x

Type: Bug Priority: Neutral
Reporter: Magnolia International Assignee: Philipp Bärfuss
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Date of First Response:

 Description   

If I create a page in a project that has STK (not sure if ETK would make a difference), and no theme is present or configured, I get an ugly FreeMarker error:

freemarker.template.TemplateModelException: get(cssFiles) failed on instance of info.magnolia.module.templatingkit.style.ThemeReference
	at freemarker.ext.beans.BeanModel.get(BeanModel.java:223)
	at freemarker.core.Dot._getAsTemplateModel(Dot.java:76)
<...>

Caused by: java.lang.NullPointerException
	at info.magnolia.module.templatingkit.style.ThemeReference.getCssFiles(ThemeReference.java:81)
	... 115 more

We should handle this more gracefully, possibly with a NullTheme implementation.

Edit: furthermore, I now notice that the site in STK is configured to use theme pop by default, whether that theme is there or not.



 Comments   
Comment by Magnolia International [ 21/Nov/11 ]

The same happens when refering a non-existing theme. Sounds like a fallback or "null" theme would be a good solution.

Also note that with 2.0 current snapshots, the only output you get in this case is ERROR: NullPointerException: <br/>

Comment by Magnolia International [ 13/Sep/12 ]

Similarly, the system isn't very resistant to missing properties; media for css files seems to be required, for example, although it's not mandated by html.

Comment by Michael Mühlebach [ 04/Nov/15 ]

Given the thousands of other issues we have open that are more highly requested, we won't be able to address this issue in the foreseeable future. Instead we will focus on issues with a higher impact, and more votes.
Thanks for taking the time to raise this issue. As you are no doubt aware this issue has been on our backlog for some time now with very little movement.
I'm going to close this to set expectations so the issue doesn't stay open for years with few updates. If the issue is still relevant please feel free to reopen it or create a new issue.

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