You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Harry Metske (JIRA)" <ji...@apache.org> on 2016/04/17 18:49:25 UTC

[jira] [Closed] (JSPWIKI-936) error when remove page with link

     [ https://issues.apache.org/jira/browse/JSPWIKI-936?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Harry Metske closed JSPWIKI-936.
--------------------------------

> error when remove page with link
> --------------------------------
>
>                 Key: JSPWIKI-936
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-936
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Core & storage
>    Affects Versions: 2.10.2
>         Environment: Windows 8.1, Java 8u45
>            Reporter: Andrew Krasnoff
>            Assignee: Harry Metske
>
> # Login
> # Create new page
> # Then click Attach, select file and click Upload
> # Edit the page and specify link to attached file name on page content -	[attached_file_name.png] in my case. Click Save
> Click Info and click "Delete Entire Page", click "Confirm" at confirmation popup
> => get error
> To make a temporary fix I updated "WikiEngine.deletePage" method with the following code:
> {code:java}
>     public void deletePage( String pageName )
>         throws ProviderException
>     {
>         WikiPage p = getPage( pageName );
>         if( p != null )
>         {
>             if( p instanceof Attachment )
>             {
>                 m_attachmentManager.deleteAttachment( (Attachment) p );
>             }
>             else
>             {
>                 Collection<String> refTo = m_referenceManager.findRefersTo(pageName);
>                 if (m_attachmentManager.hasAttachments( p ))
>                 {
>                     Collection attachments = m_attachmentManager.listAttachments( p );
>                     for( Iterator atti = attachments.iterator(); atti.hasNext(); )
>                     {
>                         Attachment attachment = (Attachment)atti.next();
>                         refTo.remove(attachment.getName());
>                         m_attachmentManager.deleteAttachment( attachment );
>                     }
>                 }
>                 m_pageManager.deletePage( p );
>                 firePageEvent( WikiPageEvent.PAGE_DELETED, pageName );
>             }
>         }
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)