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

Liferay Util methods may attempt to create a session after response is committed

    Details

      Description

      Even after the response has been committed (for example, on a sendRedirect), some utility methods may be called. Some of these utility methods will call request.getSession(), resulting in an IllegalStateException if a session has not yet been created.

      LanguageUtil.getLanguageId(HttpServletRequest)
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
      	at org.apache.catalina.connector.Request.doGetSession(Request.java:2886)
      	at org.apache.catalina.connector.Request.getSession(Request.java:2316)
      	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
      	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
      	at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3294)
      	at com.liferay.portal.util.PortalImpl.getLocale(PortalImpl.java:3222)
      	at com.liferay.portal.util.PortalUtil.getLocale(PortalUtil.java:928)
      	at com.liferay.portal.language.LanguageImpl.getLanguageId(LanguageImpl.java:513)
      	at com.liferay.portal.kernel.language.LanguageUtil.getLanguageId(LanguageUtil.java:220)
      
      SessionParamUtil.getBoolean(HttpServletRequest, HttpServletResponse, String)
      java.lang.IllegalStateException: Cannot create a session after the response has been committed
      	at org.apache.catalina.connector.Request.doGetSession(Request.java:2886)
      	at org.apache.catalina.connector.Request.getSession(Request.java:2316)
      	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:898)
      	at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:910)
      	at com.liferay.portal.kernel.util.SessionParamUtil.getBoolean(SessionParamUtil.java:35)
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

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

                  Packages

                  Version Package
                  6.2.4 CE GA5
                  6.2.X EE
                  7.0.0 M1