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

Liferay is throwing a NullPointerException when an attribute isn't present

    Details

      Description

      Description:
      After upgrading to Portal-132, Liferay search results were not displaying on search results page and a NullPointerException was generated.
      This behavior was due to a change that was made to the main_search.jspf to require the following attribute be set.

      request.setAttribute("search.jsp-highlightEnabled", queryConfig.isHighlightEnabled());

      We have overridden the search pages with our own custom search hook and didn't recognize that the hotfix came with some search changes as well. The confusing thing is why, if the attribute isn't present, Liferay is throwing a NullPointerException. According to the API documents, that's not supposed to happen. You may want to look at your implementation and ensure that if / when request attributes are not present the to getAttribute does not result in a NullPointerException.
      http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getAttribute(java.lang.String)

      Testing:
      None

      Error Log:

      16:27:31,162 ERROR [http-nio-8080-exec-9][IncludeTag:129] Current URL /mhv-portal-web/home?_3_formDate=1490992032797&p_p_id=3&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&_3_struts_action=%2Fsearch%2Fsearch&_3_cur=1&_3_format=&_3_keywords=pain&_3_groupId=0&_3_entryClassName=&_3_assetTagNames=&_3_assetCategoryIds=&_3_modified=&_3_modifiedselection=0&_3_modifiedfrom=03%2F30%2F2017&_3_modifieddayFrom=30&_3_modifiedmonthFrom=2&_3_modifiedyearFrom=2017&_3_modifiedto=03%2F31%2F2017&_3_modifieddayTo=31&_3_modifiedmonthTo=2&_3_modifiedyearTo=2017&_3_ocerSearchContainerPrimaryKeys=0%2C1%2C2%2C3%2C4 generates exception: null
      java.lang.NullPointerException
              at org.apache.jsp.html.portlet.search.main_005fsearch_005fresult_005fform_jsp._jspService(main_005fsearch_005fresult_005fform_jsp.java:819)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
              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.portal.kernel.dao.search.JSPSearchEntry.print(JSPSearchEntry.java:64)
              at org.apache.jsp.html.taglib.ui.search_005fiterator.page_jsp._jspService(page_jsp.java:1170)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
              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.taglib.util.IncludeTag.include(IncludeTag.java:290)
              at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:184)
              at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:75)
              at org.apache.jsp.html.portlet.search.search_jsp._jspx_meth_liferay_002dui_005fsearch_002diterator_005f1(search_jsp.java:3198)
              at org.apache.jsp.html.portlet.search.search_jsp._jspService(search_jsp.java:2264)
              at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              paula.lin Paula Lin
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package