[ 
https://issues.apache.org/jira/browse/JSPWIKI-649?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12864223#action_12864223
 ] 

Harry Metske commented on JSPWIKI-649:
--------------------------------------

Magnus, thanks for your help, here some answers/remarks:

when you add/edit/comment a JIRA issue, you can see at the right hand side a 
yellow question mark icon, clicking that tells you all the formatting rules. 
There is also a blue icon which is a preview you can use before submitting your 
text.
Formatting source code is like this :

{code:title=Bar.java|borderStyle=solid}
       synchronized( this )
        {
            WikiPage cached = getPageInfoFromCache( pageName );

            int latestcached = (cached != null) ? cached.getVersion() : 
Integer.MIN_VALUE;

            //
            //  If we have this version cached, remove from cache.
            //
            if( version == WikiPageProvider.LATEST_VERSION ||
                version == latestcached )
            {
                m_cache.removeEntry( pageName );
                m_textCache.removeEntry( pageName );
            }

            m_provider.deleteVersion( pageName, version );
            m_historyCache.removeEntry( pageName );
        }
{code}

Anyway, we prefer patches as JIRA attachments named JSPWIKI-nnn.patch.

Looking at your patch, could you describe the scenario where the problem occurs 
? 

regards,
Harry

> CachingProvider.deleteVersion leaves a stale m_historyCache
> -----------------------------------------------------------
>
>                 Key: JSPWIKI-649
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-649
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.8.3, 2.8.4
>         Environment: Ubuntu, Sun Java 1.6
>            Reporter: Magnus Lindberg
>            Priority: Minor
>         Attachments: jira-jspwiki-cachingprovider-patch.txt
>
>
> Hi JSPWiki developers,
> The function
>   public void deleteVersion( String pageName, int version )
> in class CachingProvider does not always update the page history cache 
> appropriately.
> As a result, NoSuchVersionException:s can be thrown, if it's later assumed 
> that a page exists,
> because it's present in the (cached) history list.
> Below patch should fix the bug. (Works for me.)
> Regards, Magnus
> <pre>
> Index: src/com/ecyrd/jspwiki/providers/CachingProvider.java
> ===================================================================
> --- src/com/ecyrd/jspwiki/providers/CachingProvider.java      (revision 
> 938415)
> +++ src/com/ecyrd/jspwiki/providers/CachingProvider.java      (working copy)
> @@ -815,10 +815,10 @@
>              {
>                  m_cache.removeEntry( pageName );
>                  m_textCache.removeEntry( pageName );
> -                m_historyCache.removeEntry( pageName );
>              }
>  
>              m_provider.deleteVersion( pageName, version );
> +            m_historyCache.removeEntry( pageName );
>          }
>      }
> </pre>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to