Issue
-
Creating a new custom object with a text field and an associated email notification that uses a FreeMarker template can result in an error that prevents the notification from being sent.
-
The following error is reported in logs:
Caused by: com.liferay.portal.kernel.log.LogSanitizerException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:_==> titulo [in template "com.liferay.notification.model.NotificationTemplate#63272" at line 1, column 3]__----_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: ${titulo.getData()} [in template "com.liferay.notification.model.NotificationTemplate#63272" at line 1, column 1]_---- [Sanitized]
at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134) ~[?:?]
at freemarker.core.UnexpectedTypeException.newDescriptionBuilder(UnexpectedTypeException.java:85) ~[?:?]
at freemarker.core.UnexpectedTypeException.<init>(UnexpectedTypeException.java:48) ~[?:?]
at freemarker.core.NonHashException.<init>(NonHashException.java:49) ~[?:?]
at freemarker.core.Dot._eval(Dot.java:48) ~[?:?]
at freemarker.core.Expression.eval(Expression.java:101) ~[?:?]
at freemarker.core.MethodCall._eval(MethodCall.java:55) ~[?:?]
at freemarker.core.Expression.eval(Expression.java:101) ~[?:?]
at freemarker.core.DollarVariable.calculateInterpolatedStringOrMarkup(DollarVariable.java:100) ~[?:?]
at freemarker.core.DollarVariable.accept(DollarVariable.java:63) ~[?:?]
at freemarker.core.Environment.visit(Environment.java:331) ~[?:?]
at freemarker.core.Environment.process(Environment.java:310) ~[?:?]
at freemarker.template.Template.process(Template.java:383) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.lambda$processTemplate$0(FreeMarkerTemplate.java:148) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerManager.render(FreeMarkerManager.java:429) ~[?:?]
at com.liferay.portal.template.freemarker.internal.FreeMarkerTemplate.processTemplate(FreeMarkerTemplate.java:135) ~[?:?]
at com.liferay.portal.template.engine.BaseTemplate.processTemplate(BaseTemplate.java:117) ~[?:?]
... 154 more
Environment
- Liferay DXP 7.4
Resolution
- The issue is addressed by LPS-203970.
- Please request a Hotfix with this fix.
Additional Information