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

Allow set to null in velocity

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 2.2 M1
    • Component/s: Velocity
    • Labels:
      None
    • Tests:
      Unit
    • Difficulty:
      Trivial
    • Similar issues:

      Description

      By default velocity does not allow set to null. For example this script:

      
      #if(!$a)
      * Variable a does not exist and this is normal
      #else
      * Variable a exist and this is not normal
      #end
      
      #set($a = "1")
      
      #if(!$a)
      * Variable a exist and this is normal
      #else
      * Variable a does not exist and this is not normal
      #end
      
      #set($a = $xwiki.null)
      
      #if(!$a)
      * Variable a does not exist and this is normal
      #else
      * Variable a exist and this is not normal
      #end
      

      But apparently this can be fixed by adding this to velocity.properties (in xwiki 1.5 this will have to be done differently)

      directive.set.null.allowed = true

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sdumitriu Sergiu Dumitriu
              Reporter:
              ludovic Ludovic Dubost
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Date of First Response: