Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-361

The ".each()" instruction doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.7 M3
    • 0.9.1252
    • Groovy
    • None
    • Unit

    Description

      This script doesn't print anything in XWiki and work perfect in groovy

      import java.util.Date
      class Measure{
         def Measure(Date pDate, int pPercent) {
         	mDate = pDate
         	mPercent = pPercent
         }
         Date mDate
         int mPercent
      }
      
      myMeasures = []
      myMeasures << new Measure(new Date(106, 10, 9), 23)
      myMeasures << new Measure(new Date(106, 10, 13), 23)
      myMeasures << new Measure(new Date(106, 10, 15), 23)
      myMeasures = myMeasures.sort{a,b -> a.mDate <=> b.mDate}
      
      myMeasures.each{laVar -> println ""+laVar.mDate+"|"+laVar.mPercent}
      

      The "for( x in myMeasures)" syntaxe works for a workaround.

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              pkernevez Philippe Kernevez
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: