You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Andrew Krasnoff (JIRA)" <ji...@apache.org> on 2016/04/12 12:26:25 UTC
[jira] [Created] (JSPWIKI-936) error when remove page with link
Andrew Krasnoff created JSPWIKI-936:
---------------------------------------
Summary: 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
# 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)