Uploaded image for project: 'Blog Application'
  1. Blog Application
  2. BLOG-278

Getting the categories location of a blog clears the posts location computed by the calling script

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 9.15.14
    • None
    • None
    • Unknown

    Description

      The Velocity macro #getBlogCategoriesLocation of Blog.BlogCode sets the variable $postsLocation to null, in addition to setting its own output parameter. A script that includes Blog.BlogCode, gets the posts location of a blog in $postsLocation and then calls #getBlogCategoriesLocation loses the posts location it just computed.

      No page shipped by the Blog Application is affected today (none keeps $postsLocation across a call to #getBlogCategoriesLocation), but wiki pages and extensions that reuse the blog macros can be.

      Steps to reproduce

      Create a page with the following content and view it:

      {{include reference="Blog.BlogCode"/}}
      
      {{velocity}}
      #getBlogPostsLocation('Blog' $postsLocation)
      #getBlogCategoriesLocation('Blog' $categoriesLocation)
      Posts: $!postsLocation, categories: $!categoriesLocation
      {{/velocity}}
      

      Expected: Posts: Blog, categories: Blog.Categories
      Actual: Posts: , categories: Blog.Categories

      Cause

      BlogCode.xml:1103: #set ($postsLocation = $NULL), copied from #getBlogPostsLocation; it should reset $categoriesLocation, the output parameter of the macro.

      Found while writing the characterization tests of BLOG-269 (BlogLocationPageTest#getBlogCategoriesLocationClearsThePostsLocationOfTheCaller pins the current behaviour).

      Attachments

        Issue Links

          Activity

            People

              vmassol Vincent Massol
              vmassol Vincent Massol
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: