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

OrganizationLocalService hasUserOrganization throws NullPointerException when inheritSuborganizations and includeSpecifiedOrganization params are true

Details

    Description

      Steps to reproduce

      1. Create an organization and assign the test user to it
      2. Note the test user's id (e.g. 20199)
      3. Note the organization's id (e.g. 20602)
      4. Navigate to Control Panel -> Server Administration -> Script and execute the following groovy script:
        import com.liferay.portal.service.OrganizationLocalServiceUtil;
        
        long userId = 20199;
        long organizationId = 20602;
        
        boolean inheritSuborganizations = true;
        boolean includeSpecifiedOrganization = true;
        
        boolean isMember = OrganizationLocalServiceUtil.hasUserOrganization(userId, organizationId, inheritSuborganizations, includeSpecifiedOrganization);
        
        out.println(isMember);

      Result: NullPointerException

      java.lang.NullPointerException
      	at com.liferay.portal.service.persistence.UserFinderImpl.getWhere(UserFinderImpl.java:1123)
      	at com.liferay.portal.service.persistence.UserFinderImpl.getWhere(UserFinderImpl.java:1036)
      	at com.liferay.portal.service.persistence.UserFinderImpl.replaceJoinAndWhere(UserFinderImpl.java:1211)
      	at com.liferay.portal.service.persistence.UserFinderImpl.countByUser(UserFinderImpl.java:133)
      	at com.liferay.portal.service.impl.OrganizationLocalServiceImpl.hasUserOrganization(OrganizationLocalServiceImpl.java:985)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:115)
      	at com.liferay.portal.spring.transaction.DefaultTransactionExecutor.execute(DefaultTransactionExecutor.java:62)
      	at com.liferay.portal.spring.transaction.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
      	at com.liferay.portal.spring.aop.ServiceBeanMethodInvocation.proceed(ServiceBeanMethodInvocation.java:111)
      	at com.liferay.portal.spring.aop.ServiceBeanAopProxy.invoke(ServiceBeanAopProxy.java:175)
      	at com.sun.proxy.$Proxy78.hasUserOrganization(Unknown Source)
      	at com.liferay.portal.service.OrganizationLocalServiceUtil.hasUserOrganization(OrganizationLocalServiceUtil.java:1055)
      	at com.monator.moh.search.contactnumbers.controller.MOHSearchContactNumbersController.searchContactNumbers(MOHSearchContactNumbersController.java:39)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
      	at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:362)
      	at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.doHandle(AnnotationMethodHandlerAdapter.java:349)
      	at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleRender(AnnotationMethodHandlerAdapter.java:291)
      	at org.springframework.web.portlet.DispatcherPortlet.doRenderService(DispatcherPortlet.java:734)
      	at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:522)
      	at org.springframework.web.portlet.FrameworkPortlet.doDispatch(FrameworkPortlet.java:470)
      	at javax.portlet.GenericPortlet.render(GenericPortlet.java:233)
      	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:103)
      	at com.liferay.portlet.ScriptDataPortletFilter.doFilter(ScriptDataPortletFilter.java:55)
      	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:100)
      	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:64)
      	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:112)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)
      	at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
      	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
      	at com.liferay.portlet.InvokerPortletImpl.invoke(InvokerPortletImpl.java:583)
      	at com.liferay.portlet.InvokerPortletImpl.invokeRender(InvokerPortletImpl.java:656)
      	at com.liferay.portlet.InvokerPortletImpl.render(InvokerPortletImpl.java:362)
      	at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1241)
      	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      	at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:57)
      	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)
      	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
      	at com.liferay.portlet.PortletContainerImpl._doRender(PortletContainerImpl.java:655)
      	at com.liferay.portlet.PortletContainerImpl.render(PortletContainerImpl.java:138)
      	at com.liferay.portlet.SecurityPortletContainerWrapper.render(SecurityPortletContainerWrapper.java:141)
      	at com.liferay.portlet.RestrictPortletContainerWrapper.render(RestrictPortletContainerWrapper.java:126)
      	at com.liferay.portal.kernel.portlet.PortletContainerUtil.render(PortletContainerUtil.java:156)
      	at com.liferay.portal.layoutconfiguration.util.PortletRenderer._render(PortletRenderer.java:125)
      	at com.liferay.portal.layoutconfiguration.util.PortletRenderer.access$4(PortletRenderer.java:107)
      	at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:180)
      	at com.liferay.portal.layoutconfiguration.util.PortletRenderer$PortletRendererCallable.doCall(PortletRenderer.java:1)
      	at com.liferay.portal.kernel.executor.CopyThreadLocalCallable.call(CopyThreadLocalCallable.java:69)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask._runTask(ThreadPoolExecutor.java:682)
      	at com.liferay.portal.kernel.concurrent.ThreadPoolExecutor$WorkerTask.run(ThreadPoolExecutor.java:593)
      	at java.lang.Thread.run(Thread.java:745)
      

      Attachments

        Issue Links

          Activity

            People

              hong.zhao Hong Zhao (Inactive)
              daniel.javorszky Daniel Javorszky (Inactive)
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                5 years, 20 weeks, 1 day ago

                Packages

                  Version Package
                  6.1.X EE
                  6.2.X EE
                  7.0.0 Beta 4