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 my...@apache.org on 2007/01/30 09:16:34 UTC

svn commit: r501337 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit: Derby.java SecurityManagerSetup.java

Author: myrnavl
Date: Tue Jan 30 00:16:33 2007
New Revision: 501337

URL: http://svn.apache.org/viewvc?view=rev&rev=501337
Log:
DERBY-2269 - running tests with SecurityManager with JSR169 support with derbyrun.jar in CLASSPATH causes NoClassDefFounError: javax.naming.Referenceable
- added if (!JDBC.supportsJSR169()) blocks to prevent calls to Class.forName("org.apache.derby.derby.jdbc.ClientDataSource"). 

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/SecurityManagerSetup.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java?view=diff&rev=501337&r1=501336&r2=501337
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java (original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/junit/Derby.java Tue Jan 30 00:16:33 2007
@@ -88,9 +88,16 @@
         // classes folder - assume all is available.
         if (!SecurityManagerSetup.isJars)
             return true;
-        
-        return hasCorrectJar("/derbyclient.jar",
+
+        // if we attempt to check on availability of the ClientDataSource with 
+        // JSR169, attempts will be made to load classes not supported in
+        // that environment, such as javax.naming.Referenceable. See DERBY-2269.
+        if (!JDBC.vmSupportsJSR169()) {
+            return hasCorrectJar("/derbyclient.jar",
                 "org.apache.derby.jdbc.ClientDataSource");
+        }
+        else
+            return false;
     }
     
     private static boolean hasCorrectJar(String jarName, String className)

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=501337&r1=501336&r2=501337
==============================================================================
--- 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 Tue Jan 30 00:16:33 2007
@@ -277,9 +277,14 @@
         if (derby != null)
 		    classPathSet.setProperty("derbyTesting.codejar", stripJar(derby));
 
-		URL client = getURL("org.apache.derby.jdbc.ClientDataSource");
-		if (client != null)
-		    classPathSet.setProperty("derbyTesting.clientjar", stripJar(client));
+		// if we attempt to check on availability of the ClientDataSource with 
+		// JSR169, attempts will be made to load classes not supported in
+		// that environment, such as javax.naming.Referenceable. See DERBY-2269.
+		if (!JDBC.vmSupportsJSR169()) {
+		    URL client = getURL("org.apache.derby.jdbc.ClientDataSource");
+		    if(client != null)
+		        classPathSet.setProperty("derbyTesting.clientjar", stripJar(client));
+		}
 	
 		return false;
 	}