Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: No Longer Reproducible
-
Affects Version/s: 6.0.6 GA
-
Fix Version/s: 6.1.0 CE RC1, --Sprint 11/12, 6.2.0 CE M2
-
Component/s: Administration, Administration > Custom Fields
-
Environment:tomcat6.0.33
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
openSUSE11.4
-
Liferay Contributor's Agreement:Accept
-
Similar Issues:
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

Change the code in EditExpandoAction. Add check for null user object while creating date object from the input parameters:
Current:
value = PortalUtil.getDate(valueDateMonth, valueDateDay, valueDateYear, valueDateHour, valueDateMinute, user.getTimeZone(), new ValueDataException());
Fixed:
{ value = PortalUtil.getDate(valueDateMonth, valueDateDay, valueDateYear, valueDateHour, valueDateMinute, user.getTimeZone(), new ValueDataException()); }if(user != null)
else
{ value = PortalUtil.getDate(valueDateMonth, valueDateDay, valueDateYear, valueDateHour, valueDateMinute, new ValueDataException()); }