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

Exceptions incorrectly logged when operator NOT is used in a statement

    Details

      Description

      Exception messages are incorrectly built in persistence_impl_finder_find.ftl methods using the negation operator. For example the following method is generated in JournalArticlePersistenceImpl:

       

      /**
       * Returns the first journal article in the ordered set where companyId = ? and status ≠ ?.
       *
       * @param companyId the company ID
       * @param status the status
       * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
       * @return the first matching journal article
       * @throws NoSuchArticleException if a matching journal article could not be found
       */
       @Override
       public JournalArticle findByC_NotST_First(long companyId, int status,
       OrderByComparator<JournalArticle> orderByComparator)
       throws NoSuchArticleException {
      
          JournalArticle journalArticle = fetchByC_NotST_First(companyId, status,
             orderByComparator);
      
          if (journalArticle != null) {
            return journalArticle;
          }
      
          StringBundler msg = new StringBundler(6);
          msg.append(_NO_SUCH_ENTITY_WITH_KEY);
          msg.append("companyId=");
          msg.append(companyId);
          msg.append(", status=");
          msg.append(status);
          msg.append("}");
       
          throw new NoSuchArticleException(msg.toString());
       }
      

       

      (Current behaviour):

      Resulting in a exception message like this when there is not an article with a status different than the specified one:

      No JournalArticle exists with the key {groupId=23952, articleId=/1067002, status=8}

        

      Expected behaviour: Messages generated by these kind of methods should look like:

      No JournalArticle exists with the key {groupId=23952, articleId=/1067002, status!=8}

        Attachments

          Activity

            People

            Assignee:
            summer.zhang Summer Zhang
            Reporter:
            cristina.rodriguez Cristina Rodriguez
            Participants of an Issue:
            Recent user:
            Joel Garman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 32 weeks, 2 days ago

                Packages

                Version Package
                7.0.0 DXP FP86
                7.0.10.12 DXP SP12
                7.0.X
                7.1.10 DXP FP14
                7.1.X
                7.2.10 DXP FP2
                7.2.10.1 DXP SP1
                7.2.1 CE GA2
                7.2.X
                7.3.0 CE GA1
                7.3.10 DXP GA1
                Master