Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-843

Calling "empty" javabean method on automatically upgraded array

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7
    • 2.0
    • Engine
    • None

    Description

      Velocity has a feature that allows calling List methods on arrays.
      I tried doing that on a String array.

      #if ($data.viewOnlineLinkLocales.empty)
      Hello
      #end
      

      "data" has a method:

          public List<String> getViewOnlineLinkLocales() {
              String localeStr = getProperty(LOCALES);
              if (localeStr == null) {
                  return new String[0];
              }
              return StringUtils..split(",");
          }
      

      When I try this for localeStr = null, the "empty" is returning false. On the other hand when I replace it with "isEmpty()" it correctly returns true.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            cbrisson Claude Brisson
            krzyk Krzysztof Krason
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment