|Title|Reading of Variable not working for older versions
|Date|17-Jun-2005 09:42:22 EEST
|Version|2.2.19
|Submitter|DirkFrederickx
|[Bug criticality]|MediumBug
|Browser version|IE
|[Bug status]|ClosedBug
|[PageProvider] used|VersioningFileProvider
|Servlet Container|Tomcat
|Operating System|Win2000
|URL|
|Java version|


Retrieving a variable of an older version doesnt work anymore.
This feature was still working in 2.1.103.


{{{
<wiki:HistoryIterator id="currentPage">

  <wiki:Variable var='versionLabel' default=" "/> 

</wiki:HistoryIterator>
}}}


See also [VersionLabel]
--[DF|DirkFrederickx]

----

Here's a workaround which seems to solve the problem.
Apparently the wiki metadata of a page only gets initialised by a call to textToHTML.
Obviously, this is not done as you iterate over different versions of a page. 
Below you find the additional java in the jsp which does the trick.
-- [DF|DirkFrederickx]
{{{
          <wiki:HistoryIterator id="currentPage">
                <%
                   //need to run textToHtml so that variables get initialised again !!
                   //Ugh!
                   WikiContext cc = (WikiContext) c.clone();
                   cc.setPage(currentPage);
                   String pagedata = cc.getEngine().getPureText( currentPage );
                   cc.getEngine().textToHTML( cc, pagedata );                   
                %>
                <wiki:Variable var='versionLabel' default=" "/> 
            </wiki:HistoryIterator>
}}}

----

Okay, this is a really thorny problem.  I've been trying to implement fixes for this, and the best I've so far come up with is a very complicated OutOfMemoryError.  It stems from the fact that our metadata handling is done during page parsing, and we're actually relying of ReferenceManager side-effects to get the variables updated.  This, of course, is utterly stupid.

I put in a workaround for 2.2.26, but it'll surely create more troubles than what it's worth.

I'll put this one on hold for a while and replace the entire metadata subsystem for the next major release.  Foo.

-- JanneJalkanen

----
We now have a next major release, and I assume it is now solved, if that's not the case, please feel free to re-open it.

--HarryMetske