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

Pointless conditional in HighlightUtil.highlight

    Details

      Description

      Description
      There is a pointless if statement near the beginning of the HighlightUtil.highlight method. The first if statement in the method says

      		if (Validator.isNull(s) || ArrayUtil.isEmpty(queryTerms)) {
      			return s;
      		}
      

      This is immediately followed by:

      		if (queryTerms.length == 0) {
      			return StringPool.BLANK;
      		}
      

      This will never be true, since we would have already returned s if it was. Moreover, it wouldn't even make sense to return StringPool.BLANK here. This if statement should be removed.

      Steps to Reproduce
      N/A

      Issue affects
      master (62ad475678e5d1e6ac813535e4c376a3afade9bc)
      ee-7.0.x (f5915d5395f8852f3660ea102d614118fb367c0f)
      ee-6.2.x (2c086260fa0db99db9981975f3c5266ce627672a)
      In ee-6.2.x, the method where this issue occurs is SearchUtil.highlight

        Attachments

          Activity

            People

            Assignee:
            summer.zhang Summer Zhang
            Reporter:
            michael.bowerman Michael Bowerman (Inactive)
            Participants of an Issue:
            Recent user:
            Csaba Turcsan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

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

                Packages

                Version Package
                7.0.0 DXP FP14
                7.0.0 DXP SP3
                7.0.3 CE GA4
                7.0.X EE
                7.1.X
                Master