NullPointerException error seen with custom Terms Of Use
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- When custom content in "Terms of Use" is set via Instance Configuration in Control Panel, and logging in as a new user for the first time, a NullPointerException is seen.
Resolution
-
The Terms of Use code expects and requires a
<section /> tag with content id to exist, and when this id is not found, it will trigger a NullPointerException error.
- Verify that the theme has a
<section /> tag with content id, such as seen in Liferay's unstyled theme:
<section id="content">
<h2 class="hide-accessible sr-only" role="heading" aria-level="1">${htmlUtil.escape(the_title)}</h2>
<#if selectable>
<@liferay_util["include"] page=content_include />
<#else>
${portletDisplay.recycle()}
${portletDisplay.setTitle(the_title)}
<@liferay_theme["wrap-portlet"] page="portlet.ftl">
<@liferay_util["include"] page=content_include />
</@>
</#if>
</section>
Liferay's classic theme has a slightly different tag declaration (but otherwise the same content):
<section class="${portal_content_css_class} flex-fill" id="content">
Did this article resolve your issue ?