You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/10/16 20:24:54 UTC

svn commit: r464610 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting: functionTests/util/derby_tests.policy junit/SecurityManagerSetup.java

Author: djd
Date: Mon Oct 16 11:24:53 2006
New Revision: 464610

URL: http://svn.apache.org/viewvc?view=rev&rev=464610
Log:
DERBY-1791 Setup the policy file and security manager setup so that the system property
derbyTesting.testjarpath describes the file location of derbyTesting.jar so that ij
can be given permission to read its contents. This is to access the SQL scripts within the resource.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy?view=diff&rev=464610&r1=464609&r2=464610
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/derby_tests.policy Mon Oct 16 11:24:53 2006
@@ -96,7 +96,7 @@
   permission java.io.FilePermission "${user.dir}${/}-", "read";
   
   // ij needs permission to read the sql files in this jar
-  permission java.io.FilePermission "${derbyTesting.codedir}${/}derbyTesting.jar", "read";
+  permission java.io.FilePermission "${derbyTesting.testjarpath}", "read";
   
 };
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java?view=diff&rev=464610&r1=464609&r2=464610
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java Mon Oct 16 11:24:53 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.derbyTesting.junit;
 
+import java.io.File;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedActionException;
@@ -192,17 +193,20 @@
 	 * <P>
 	 * Classpath:
 	 * <BR>
-	 * derbyTesting.codeclasses set to location of classes folder
+	 * derbyTesting.codeclasses set to URL of classes folder
 	 * <P>
 	 * Jar files:
 	 * <BR>
-	 * derbyTesting.codejar - location of derby.jar,
+	 * derbyTesting.codejar - URL of derby.jar,
 	 * derbynet.jar and derbytools.jar, all assumed to be in the
 	 * same location.
 	 * <BR>
-	 * derbyTesting.clientjar - location of derbyclient.jar (FUTURE)
+	 * derbyTesting.clientjar - URL of derbyclient.jar
 	 * <BR>
-	 * derbyTesting.testjar - location of derbyTesting.jar (FUTURE)
+	 * derbyTesting.testjar - URL of derbyTesting.jar
+     * <BR>
+     * derbyTesting.testjarpath - File system path to derbyTesting.jar
+     * if the jar has a URL with a file protocol.
 	 * 
 	 */
 	private static boolean determineClasspath()
@@ -223,6 +227,11 @@
 			return false;
 		}
 		classPathSet.setProperty("derbyTesting.testjar", stripJar(testing));
+        if (testing.getProtocol().equals("file")) {
+           File f = new File(testing.getPath());
+           classPathSet.setProperty("derbyTesting.testjarpath",
+                                               f.getAbsolutePath());
+        }
         isJars = true;
 		
 		URL derby = null;