Issue
- A Web Content Template from previous versions with the following code is rendered:
<#assign journalArticlePreferencesMap = {
"portletSetupPortletDecoratorId": "barebone",
"groupId": "54321",
"articleId": "12345"
}/>
<#assign journalArticlePreferences = freeMarkerPortletPreferences.getPreferences(journalArticlePreferencesMap) />
<@liferay_portlet["runtime"]
defaultPreferences="${journalArticlePreferences}"
instanceId="myEmbeddedContent"
portletProviderAction=portletProviderAction.VIEW
portletName="com_liferay_journal_content_web_portlet_JournalContentPortlet"
/>
<#assign VOID = freeMarkerPortletPreferences.reset() />
- But, the following error is shown:
The following has evaluated to null or missing:
==> freeMarkerPortletPreferences.reset [in template "20101#20128#36309" at line 16, column 17]
----
Tip: It's the step after the last dot that caused this error, not those before it.
----
Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??
----
----
FTL stack trace ("~" means nesting-related):
- Failed at: #assign VOID = freeMarkerPortletPrefe... [in template "20101#20128#36309" at line 16, column 1]
Environment
Resolution
- The error is thrown because the method reset from TemplatePortletPreferences class is no longer available in Liferay DXP 7.2 and higher.
- Some users used to call this method to change their portlet's preferences on the fly without having to reconfigure it via UI.
- If they want to continue to get this effect, as a workaround, they could change the value of the attribute instanceId to a value based on the article ID.