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

Missing Wildcards for Name param in FragmentEntryLocalService.getFragmentEntries service

Details

    Description

      Description

      @Override
      public List<FragmentEntry> getFragmentEntries(
      	long groupId, long fragmentCollectionId, String name, int start,
      	int end, OrderByComparator<FragmentEntry> orderByComparator) {
      
      	if (Validator.isNull(name)) {
      		return fragmentEntryPersistence.findByG_FCI(
      			groupId, fragmentCollectionId, start, end, orderByComparator);
      	}
      
      	return fragmentEntryPersistence.findByG_FCI_LikeN(
      		groupId, fragmentCollectionId, name, start, end, orderByComparator);
      }
      

      We don't use wildcards in the name param for likeN, makin the getCall require an exact match instead of a partial, which makes no sense since 1, we are using an orderByComparator, so we should expect a orderByNameComparator to work as well. Even if this does technically work if you expect it to make exact fragmentEntry matches(for generating fragmentEntryKey could be one), this does seem like bad practice unless if there is a specific example where it is needed like this, but if so we should at least improve the name of the service to reduce confuability.

      Expected Result
      Wildcards appended to localService name paramter

      Actual Result
      Exact string match required for name paramter

      Tested on Tomcat 9.0.10 + MySQL 5.7
      Portal master GIT ID: eb2fa12bf6da50a6408c04e6050768a91600d301

      Attachments

        Issue Links

          Activity

            People

              kyle.miho Kyle Miho
              kyle.miho Kyle Miho
              Kiyoshi Lee Kiyoshi Lee
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                3 years, 41 weeks, 5 days ago

                Packages

                  Version Package
                  7.2.10 DXP FP1
                  7.2.1 CE GA2
                  7.2.X
                  7.3.10 DXP GA1
                  Master