Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-3520

Cannot add an array to a collection using addAll in Velocity

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 16.10.0
    • Velocity
    • None
    • Unknown

    Description

      Steps to reproduce:

      Execute the following Velocity code in XWiki:

      #set ($mySet = $collectiontool.getOrderedSet())
      #set ($myString = 'a few words')
      #set ($myArray = $stringtool.split($myString, ' '))
      #set ($discard = $mySet.addAll($myArray))
      $mySet
      

      Expected result:

      [a, few, words]
      

      Actual result:

      []
      

      The root cause seems to be that the conversion of the argument fails because during the conversion the type variable isn't resolved.

      See XCOMMONS-129 for a workaround how to convert the array to a list first.

      Attachments

        Activity

          People

            Unassigned Unassigned
            MichaelHamann Michael Hamann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: