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

SQL crash during search in web content with multiple structure

    Details

      Description

      Reproduction steps:

      1.) Use a vanilla bundle with fix pack portal-148.

      2.) Start the portal and go to Control Panel --> Configuration --> Server Administration --> Scripts, copy and paste the content of 'crash-search.groovy' and execute the code:

      Result: You will see the following code in application server:

      13:12:45,213 ERROR [http-bio-8080-exec-9][EditServerAction:528] SanitizerLogWrapper warning: Following message contains CRLF characters
       java.lang.IllegalArgumentException: Positional parameter does not exist: 20 in query: SELECT JournalArticle.* FROM JournalArticle WHERE JournalArticle.id_ IN ( SELECT DISTINCT JournalArticle.id_ FROM JournalArticle LEFT JOIN JournalArticle tempJournalArticle ON (JournalArticle.status != 8) AND (tempJournalArticle.status != 8) AND (JournalArticle.groupId = tempJournalArticle.groupId) AND (JournalArticle.articleId = tempJournalArticle.articleId) AND (JournalArticle.version < tempJournalArticle.version) WHERE (JournalArticle.companyId = ?) AND ((JournalArticle.folderId = ? )) AND (JournalArticle.classNameId = ?) AND (JournalArticle.status != ?) AND ((JournalArticle.structureId LIKE ? OR ? IS NULL) ) AND (tempJournalArticle.id_ IS NULL) AND ( (JournalArticle.articleId LIKE ? OR ? IS NULL) AND (JournalArticle.title LIKE ? OR ? IS NULL) AND (JournalArticle.description LIKE ? OR ? IS NULL) AND (JournalArticle.content LIKE ? OR ? IS NULL) AND (JournalArticle.displayDate >= ? OR ? IS NULL) AND (JournalArticle.displayDate <= ? OR ? IS NULL) AND (JournalArticle.reviewDate <= ? OR ? IS NULL) ) ) ORDER BY JournalArticle.id_ ASC
       Line 1: import com.liferay.portlet.journal.service.JournalArticleServiceUtil
       Line 2: import com.liferay.portal.kernel.util.StringPool
       Line 3: import com.liferay.portal.kernel.workflow.WorkflowConstants
       Line 4: import java.util.List
       Line 5: import java.util.ArrayList
       Line 6:
       Line 7: List<Long> folderIds = new ArrayList<Long>();
       Line 8:
       Line 9: folderIds.add(0l);
       Line 10:
       Line 11: String[] ddmStructures = ["123", "123"];
       Line 12:
       Line 13: JournalArticleServiceUtil.search(0L, 0L, folderIds, 0,"", null, "","", "", "", ddmStructures, null, null, null,WorkflowConstants.STATUS_ANY , null, true, -1, -1, null);
      
      

      To make the script work you will need to delete one element from String[] ddmStructures, for example using 'String[] ddmStructures = ["123"];' will work.

       

      The reported matter was escalated first, please find below Dani's analyses:

      This is a bug.

      The error message states that "Positional parameter does not exist: 20". If you check the printed SQL, there are exactly 20 question marks, 0-19. A 21st replace was attempted, hence the exception.

      Issue comes because when

      JournalArticleFinderImpl.replaceTypeStructureTemplate

      (called by doFindByC_G_F_C_A_V_T_D_C_T_S_T_D_R) is called, it ignores the fact that there can be more than one structure or template - meaning: It adds only one placeholder whereas it should add as much as there are entries in the array.

      Both the ddmStructure and ddmTemplate fields are affected.

       

      also tested:

      6.2x @ commit (935675a0637bdf7554ccf45ad6ae4f082c3b9439) repordunced

      master @ commit (18de6fb68fc0bd6bf3dde7a9a258226f7660548c) repordunced

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              lu.liu Lu Liu
              Reporter:
              rimi.saadou Rimi Saadou (Inactive)
              Participants of an Issue:
              Recent user:
              Brian Wulbern
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 21 weeks, 3 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 DXP FP23
                  7.0.X EE
                  7.0.4 CE GA5
                  7.1.X
                  Master