db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r543565 - in /db/derby/code/trunk/java: engine/org/apache/derby/impl/services/reflect/ testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/derbyTesting/functionTests/tests/store/
Date Fri, 01 Jun 2007 18:17:21 GMT
Author: djd
Date: Fri Jun  1 11:17:20 2007
New Revision: 543565

URL: http://svn.apache.org/viewvc?view=rev&rev=543565
Log:
DERBY-2040 Open the JarFile for the installed jar (in JarLoader) using a privileged block.
Change various tests that failed with a security manager due to this issue to run with
the security manager. 

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java?view=diff&rev=543565&r1=543564&r2=543565
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/services/reflect/JarLoader.java
Fri Jun  1 11:17:20 2007
@@ -30,8 +30,10 @@
 import java.io.InputStream;
 import java.io.IOException;
 
+import java.security.AccessController;
 import java.security.CodeSource;
 import java.security.GeneralSecurityException;
+import java.security.PrivilegedActionException;
 import java.security.SecureClassLoader;
 import java.security.cert.Certificate;
 import java.security.cert.X509Certificate;
@@ -102,7 +104,20 @@
 					schemaName, sqlName);
 
 			if (installedJar instanceof File) {
-				jar = new JarFile((File) installedJar);
+                try {
+                    jar = (JarFile) AccessController.doPrivileged
+                    (new java.security.PrivilegedExceptionAction(){
+
+                        public Object run() throws IOException {
+                        return new JarFile((File) installedJar);
+
+                        }
+
+                    }
+                     );
+                } catch (PrivilegedActionException pae) {
+                    throw (IOException) pae.getException();
+                }
 				return;
 			}
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java?view=diff&rev=543565&r1=543564&r2=543565
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/DatabaseClassLoadingTest.java
Fri Jun  1 11:17:20 2007
@@ -81,58 +81,36 @@
         // as it uses server side jdbc.
         Test test = suite;
         if (JDBC.vmSupportsJDBC3()) {
-        
-          suite.addTest(new DatabaseClassLoadingTest("testJarHandling"));
-        
-          suite.addTest(new DatabaseClassLoadingTest("testWithNoInstalledJars"));
-          suite.addTest(new DatabaseClassLoadingTest("testWithNoClasspath"));
+            
+            String[] orderedTests = {
+                "testJarHandling",
+                "testWithNoInstalledJars",
+                "testWithNoClasspath",
+                "testSetClasspath",
+                "testAddContact",
+                "testGetResource",          
+                "testAlterTable",
+                "testClassPathRollback",
+                "testReplaceJar",      
+                "testReplacedClass",
+                "testSecondJar",
+                "testSignedJar",
+                "testCreateDatabaseJar",
+                "testHackedJarReplacedClass",
+                "testInvalidJar",
+                "testRemoveJar",
+                "testLoadJavaClassIndirectly",
+                "testLoadJavaClassDirectly",
+                "testLoadJavaClassDirectly2",
+                "testLoadJavaClassDirectly3",
+                "testLoadDerbyClassIndirectly",
  
-          suite.addTest(
-                SecurityManagerSetup.noSecurityManager(
-                        new DatabaseClassLoadingTest("testSetClasspath")));
-        
-          
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                new DatabaseClassLoadingTest("testAddContact")));
-        
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                new DatabaseClassLoadingTest("testGetResource")));
-           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testAlterTable")));
-
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testClassPathRollback")));
-           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testReplaceJar")));        
-           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testReplacedClass")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testSecondJar")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testSignedJar")));
-           
-           suite.addTest(new DatabaseClassLoadingTest("testCreateDatabaseJar"));
-           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testHackedJarReplacedClass")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testInvalidJar")));           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testRemoveJar"))); 
-           
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testLoadJavaClassIndirectly"))); 
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testLoadJavaClassDirectly")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testLoadJavaClassDirectly2")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testLoadJavaClassDirectly3")));
-           suite.addTest(SecurityManagerSetup.noSecurityManager(
-                   new DatabaseClassLoadingTest("testLoadDerbyClassIndirectly")));
+            };
+            
+            for (int i = 0; i < orderedTests.length; i++)
+            {
+                suite.addTest(new DatabaseClassLoadingTest(orderedTests[i]));
+            }
        
            suite.addTest(SecurityManagerSetup.noSecurityManager(
                    new DatabaseClassLoadingTest("testDatabaseInJar"))); 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties?view=diff&rev=543565&r1=543564&r2=543565
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/BackupPathTests_app.properties
Fri Jun  1 11:17:20 2007
@@ -18,6 +18,3 @@
 #Exclude for J2ME/Foundation - test uses procedure with server-side JDBC
 runwithfoundation=false
 
-# Test fails with security manager due to bug DEBRY-537
-noSecurityManager=true
-

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties?view=diff&rev=543565&r1=543564&r2=543565
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/store/OnlineBackupTest3_app.properties
Fri Jun  1 11:17:20 2007
@@ -17,6 +17,3 @@
 
 #Exclude for J2ME/Foundation - test uses procedure with server-side JDBC
 runwithfoundation=false
-
-# Test fails with security manager due to bug DEBRY-537
-noSecurityManager=true



Mime
View raw message