PUBLIC - Liferay Portal Community Edition
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-26665

User Group Site Pages: "VirtualLayout.injectVirtualGroupURL" is called, even when the Layout is of type URL

    Details

    • Branch Version/s:
      6.1.x
    • Backported to Branch:
      Committed
    • Liferay Contributor's Agreement:
      Accept
    • Similar Issues:
      Show 5 results 

      Description

      In LR 6.1 VirtualLayout.injectVirtualGroupURL is called, even when the Layout is of type URL.

      The code snippet within injectVirtualGroupURL

      int pos = layoutURL.indexOf(group.getFriendlyURL());

      will return -1.

      Therefore the next statement

      sb.append(layoutURL.substring(0, pos));

      will fail.

      The bug can be reproduced as follows:

      • Create a User Group
      • Create a Page (private or public) of type URL within this User Group
      • Set a valid value for the URL field (e.g. http://www.liferay.com)
      • Assign a User to this User Group
      • Log in as this user and open user's (private or public) pages

      Error Message:

      javax.servlet.jsp.JspException: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getURL' in class com.liferay.portal.theme.NavItem threw exception java.lang.IllegalStateException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at test-theme_SERVLET_CONTEXT_/templates/navigation.vm[line 13, column 52]

      Possible solution:

      Check type of the Layout.

      public String getRegularURL(HttpServletRequest request)
      throws PortalException, SystemException {

      String layoutURL = _sourceLayout.getRegularURL(request);
      // Custom Code
      if(LayoutConstants.TYPE_URL.equals(_sourceLayout.getType()))

      { return layoutURL; }

      // Custom Code

      return injectVirtualGroupURL(layoutURL);
      }

        Activity

        Hide
        Martin Steinmann added a comment -

        We encountered this issue also in 6.1.0 CE GA1

        Show
        Martin Steinmann added a comment - We encountered this issue also in 6.1.0 CE GA1
        Hide
        Graeme Steyn added a comment -

        Proposed fixed based on what we are running in 6.1.20 EE in production.

        Show
        Graeme Steyn added a comment - Proposed fixed based on what we are running in 6.1.20 EE in production.
        Hide
        Graeme Steyn added a comment -

        Created a new pull request to Julio Camarero as the originalone was directly to the liferay master.

        https://github.com/juliocamarero/liferay-portal/pull/1565

        Show
        Graeme Steyn added a comment - Created a new pull request to Julio Camarero as the originalone was directly to the liferay master. https://github.com/juliocamarero/liferay-portal/pull/1565
        Hide
        Sophia Zhang added a comment - - edited

        PASSED Manual Testing following the steps in the description.

        More detail to reproduce this issue:
        When creating a user group, you have to select a User Group Site to add public or private pages.

        Reproduced on:
        Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: cb70fe9d1acc4dec3baa4fd9c17853c11ea60921.

        Got error messages as description shown.

        Fixed on:
        Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: cb473a5a26d5dcd481ace6c9f39fe2cb82d205d3.
        Tomcat 7.0 + MYSQL 5. Portal 6.2.x GIT ID: 65fbed1d6dfbf9fbcdc3f71134bcf1c8ccc4e1da.

        No error messages and user can be redirected to the right url page.

        Show
        Sophia Zhang added a comment - - edited PASSED Manual Testing following the steps in the description. More detail to reproduce this issue: When creating a user group, you have to select a User Group Site to add public or private pages. Reproduced on: Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: cb70fe9d1acc4dec3baa4fd9c17853c11ea60921. Got error messages as description shown. Fixed on: Tomcat 7.0 + MySQL 5. Portal 6.1.x EE GIT ID: cb473a5a26d5dcd481ace6c9f39fe2cb82d205d3. Tomcat 7.0 + MYSQL 5. Portal 6.2.x GIT ID: 65fbed1d6dfbf9fbcdc3f71134bcf1c8ccc4e1da. No error messages and user can be redirected to the right url page.

          People

          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

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

              Development

                Structure Helper Panel