db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r539614 - /db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
Date Fri, 18 May 2007 22:09:30 GMT
Author: djd
Date: Fri May 18 15:09:28 2007
New Revision: 539614

URL: http://svn.apache.org/viewvc?view=rev&rev=539614
Log:
DERBY-2673 If derby.system.home does not exist then first attempt to create it with File.mkdir()
to
avoid requiring read permission on the parent folder.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java?view=diff&rev=539614&r1=539613&r2=539614
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/monitor/FileMonitor.java
Fri May 18 15:09:28 2007
@@ -130,7 +130,20 @@
 
 				try {
 					// SECURITY PERMISSION - OP2b
-					home.mkdirs();
+                    // Attempt to create just the folder initially
+                    // which does not require read permission on
+                    // the parent folder. This is to allow a policy
+                    // file to limit file permissions for derby.jar
+                    // to be contained under derby.system.home.
+                    // If the folder cannot be created that way
+                    // due to missing parent folder(s) 
+                    // then mkdir() will return false and thus
+                    // mkdirs will be called to create the
+                    // intermediate folders. This use of mkdir()
+                    // and mkdirs() retains existing (pre10.3) behaviour
+                    // but avoids requiring read permission on the parent
+                    // directory if it exists.
+					boolean created = home.mkdir() || home.mkdirs();
 				} catch (SecurityException se) {
 					return false;
 				}



Mime
View raw message