jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jalka...@apache.org
Subject svn commit: r647625 - in /incubator/jspwiki/trunk: ChangeLog src/com/ecyrd/jspwiki/Release.java src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
Date Sun, 13 Apr 2008 20:52:23 GMT
Author: jalkanen
Date: Sun Apr 13 13:52:22 2008
New Revision: 647625

URL: http://svn.apache.org/viewvc?rev=647625&view=rev
Log:
[JSPWIKI-10] Patch from Harry Metske to make sure VersioningFileProvider and AbstractFileProvider
check for proper permissions.

Modified:
    incubator/jspwiki/trunk/ChangeLog
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
    incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java

Modified: incubator/jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/ChangeLog?rev=647625&r1=647624&r2=647625&view=diff
==============================================================================
--- incubator/jspwiki/trunk/ChangeLog (original)
+++ incubator/jspwiki/trunk/ChangeLog Sun Apr 13 13:52:22 2008
@@ -1,3 +1,11 @@
+2008-04-13  Janne Jalkanen <jalkanen@apache.org>
+
+        * 2.7.0-svn-12
+        
+        * [JSPWIKI-10] Patch from Harry Metske to make sure 
+        VersioningFileProvider and AbstractFileProvider check for
+        proper permissions.
+
 2008-04-12  Janne Jalkanen <jalkanen@apache.org>
 
         * 2.7.0-svn-11

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java?rev=647625&r1=647624&r2=647625&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/Release.java Sun Apr 13 13:52:22 2008
@@ -77,7 +77,7 @@
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "11";
+    public static final String     BUILD         = "12";
     
     /**
      *  This is the generic version string you should use

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java?rev=647625&r1=647624&r2=647625&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/AbstractFileProvider.java Sun
Apr 13 13:52:22 2008
@@ -84,12 +84,21 @@
 
         if( !f.exists() )
         {
-            f.mkdirs();
-        }
-        else if( !f.isDirectory() )
-        {
-            throw new IOException("Page directory is not a directory: "+m_pageDirectory);
+            if (!f.mkdirs()) 
+            {
+              throw new IOException("Failed to create page directory "+f.getAbsolutePath()+"
, please check property "+PROP_PAGEDIR);  
+            }
         }
+        else {
+            if( !f.isDirectory() )
+            {
+            throw new IOException("Page directory is not a directory: "+f.getAbsolutePath());
+            }
+            if (!f.canWrite()) 
+            {
+                throw new IOException("Page directory is not writable: "+f.getAbsolutePath());
   
+            }
+            }
         
         m_engine = engine;
 

Modified: incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java
URL: http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java?rev=647625&r1=647624&r2=647625&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java (original)
+++ incubator/jspwiki/trunk/src/com/ecyrd/jspwiki/providers/VersioningFileProvider.java Sun
Apr 13 13:52:22 2008
@@ -73,6 +73,27 @@
                IOException
     {
         super.initialize( engine, properties );
+        // some additional sanity checks :
+        File oldpages = new File(getPageDirectory(), PAGEDIR);
+        if (!oldpages.exists())
+        {
+            if (!oldpages.mkdirs())
+            {
+                throw new IOException("Failed to create page version directory " + oldpages.getAbsolutePath());
+            }
+        }
+        else
+        {
+            if (!oldpages.isDirectory())
+            {
+                throw new IOException("Page version directory is not a directory: " + oldpages.getAbsolutePath());
+            }
+            if (!oldpages.canWrite())
+            {
+                throw new IOException("Page version directory is not writable: " + oldpages.getAbsolutePath());
+            }
+        }
+        log.info("Using directory " + oldpages.getAbsolutePath() + " for storing old versions
of pages");
     }
 
     /**



Mime
View raw message