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

Defining Mobile Device Rules on a Page

    Details

      Description

      After creating a mobile device rules for one page is not possible to edit all menu items on the page itself. In console is possibile to see the following error.

      
      21:40:06,918 ERROR [http-bio-8080-exec-8][IncludeTag:129] Current URL /group/control_panel/manage?p_p_auth=aXafdG5b&p_p_id=156&p_p_lifecycle=2&p_p_state=maximized&p_p_mode=view&p_p_cacheability=cacheLevelPage&doAsGroupId=26302&refererPlid=23486&controlPanelCategory=sites&_156_treeId=layoutsTree&_156_groupId=26302&_156_tabs1=public-pages&_156_viewLayout=true&_156_struts_action=%2Fgroup_pages%2Fedit_layouts&_156_selPlid=26310&_156_historyKey= generates exception: null
      java.lang.NullPointerException
      at org.apache.jsp.html.portlet.layouts_005fadmin.layout.mobile_005fdevice_005frules_005frule_005fgroup_005finstance_005faction_jsp._jspService(mobile_005fdevice_005frules_005frule_005fgroup_005finstance_005faction_jsp.java:740)
      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:1070)
      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:295)
      at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:192)
      at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:83)
      at org.apache.jsp.html.portlet.layouts_005fadmin.layout.mobile_005fdevice_005frules_jsp._jspx_meth_liferay_002dui_005fsearch_002diterator_005f0(mobile_005fdevice_005frules_jsp.java:2152)
      at org.apache.jsp.html.portlet.layouts_005fadmin.layout.mobile_005fdevice_005frules_jsp._jspService(mobile_005fdevice_005frules_jsp.java:1669)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
      

      I have found a workaround creating an Hook on file

      layouts_admin/layout/mobile_device_rules_rule_group_instance_action.jsp

      Error occurs since code like this

      String taglibActionHandler = renderResponse.getNamespace() + "mobileDeviceActionHandler('" + viewRuleGroupInstanceActionsURL.toString() + "');";
      

      gives a NPE since renderResponse is null.

      So as workaround, I just modified the first part of the JSP file as described

      SearchContainer searchContainer = (SearchContainer)request.getAttribute("liferay-ui:search:searchContainer");
      
       String redirect = searchContainer.getIteratorURL().toString();
       
       String closeRedirect = ParamUtil.getString(request, "closeRedirect");
       
       ResultRow row = (ResultRow)request.getAttribute(WebKeys.SEARCH_CONTAINER_RESULT_ROW);
       
      MDRRuleGroupInstance mdrRuleGroupInstance = (MDRRuleGroupInstance)row.getObject();
      
      MDRRuleGroup mdrRuleGroup = MDRRuleGroupLocalServiceUtil.getMDRRuleGroup(mdrRuleGroupInstance.getRuleGroupId());
      
      /*WORKAROUND */
      PortletResponse responseAvailable = renderResponse;
      if (renderResponse == null)
          responseAvailable = liferayPortletResponse; //6.2 GA6 was not defined!!!
      

      and changing all renderResponse references to the new variable responseAvailable

        Attachments

          Activity

            People

            • Assignee:
              lu.liu Lu Liu
              Reporter:
              ccarlenzoli@gmail.com Claudio Carlenzoli
              Participants of an Issue:
              Recent user:
              Marta Elicegui
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                2 years, 47 weeks, 2 days ago

                Packages

                Version Package
                6.2.X EE
                7.0.X
                Master