Author: jalkanen
Date: Thu Mar 13 13:54:31 2008
New Revision: 636888

URL: http://svn.apache.org/viewvc?rev=636888&view=rev
Log:
JSPWIKI-162 - now checks properly for parent page existing.

Modified:
    
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java

Modified: 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java
URL: 
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java?rev=636888&r1=636887&r2=636888&view=diff
==============================================================================
--- 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java 
(original)
+++ 
incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/attachment/AttachmentManager.java 
Thu Mar 13 13:54:31 2008
@@ -479,6 +479,15 @@
             return;
         }
 
+        //
+        //  Checks if the actual, real page exists without any modifications
+        //  or aliases.  We cannot store an attachment to a non-existant page.
+        //
+        if( !m_engine.getPageManager().pageExists( att.getParentName() ) )
+        {
+            throw new ProviderException("Parent page does not exist");
+        }
+        
         m_provider.putAttachmentData( att, in );
 
         m_engine.getReferenceManager().updateReferences( att.getName(),


Reply via email to