Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-22831

EditExpandoAction.java throws NULL exception when a custom date attribute is added to Create Account page

    Details

    • Liferay Contributor's Agreement:
      Accept

      Description

      Steps to reproduce:

      1. Add a custom attribute of type date to the User
      2. Create a hook for Create Account page - html/portlet/login/create_account.jsp
      3. Add the custom attribute created in step 1:
      4. Deploy the hook and open the create account page.
      5. Fill in the details and click Save.
      6. Observe that an error message is shown on the page "Sign In is temporarily unavailable."

      Logs:
      03:59:33,700 ERROR [jsp:154] java.lang.NullPointerException
      at com.liferay.portlet.expando.action.EditExpandoAction.getValue(EditExpandoAction.java:97)
      at com.liferay.portal.util.PortalImpl.getExpandoBridgeAttributes(PortalImpl.java:1354)
      at com.liferay.portal.util.PortalUtil.getExpandoBridgeAttributes(PortalUtil.java:385)
      at com.liferay.portal.service.ServiceContextFactory.getInstance(ServiceContextFactory.java:217)
      at com.liferay.portlet.login.action.CreateAccountAction.addUser(CreateAccountAction.java:216)
      at com.liferay.portlet.login.action.CreateAccountAction.processAction(CreateAccountAction.java:98)
      at com.liferay.portal.struts.PortletRequestProcessor.process(PortletRequestProcessor.java:169)
      at com.liferay.portlet.StrutsPortlet.processAction(StrutsPortlet.java:186)
      at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
      at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
      at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:652)

      I went through the code and saw that the problem is the code in EditExpandoAction.java where it is trying to create a date object from the input parameters:

      value = PortalUtil.getDate(
      valueDateMonth, valueDateDay, valueDateYear, valueDateHour,
      valueDateMinute, user.getTimeZone(), new ValueDataException());

      But since the user hasn't yet logged in, the user object is null and hence the call user.getTimeZone() throws NullPointerException.

      Regards,
      Kapil

        Attachments

          Activity

            People

            • Assignee:
              paul.piao Paul Piao (Inactive)
              Reporter:
              kapildverma Kapil (Inactive)
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 45 weeks ago