You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Deepa Remesh <dr...@gmail.com> on 2006/03/21 18:32:11 UTC

Upgrade test and security permissions

Hi,

As part of my work on DERBY-514, I was trying to run the upgrade test
using the test harness (using RunTest class). I wrote an upgrade test
using UpgradeTester class (created in my patch attached to
DERBY-1075). UpgradeTester class uses classloaders to switch between
old and new release jars. I can run my test outside the harness. But
when I run it using the test harness, I get security exceptions when
it tries to load classes from derby.jar. Currently, I am using the
derby.jar on my local machine. Once DERBY-1049 is resolved, the
derby.jar from the releases should be available in the repository and
this can be used. In any case, it seems to me that we need to grant
read permission on the derby jar files to allow loading classes needed
in the upgrade test.

What is the best way to proceed here?

I was getting more security errors which I resolved as follows:

* File.toURL call requires read permission on the jar file. I changed
the code not to use File.toURL. Instead, the URL is created directly
by specifying "file:" protocol.

* Added the following permissions for derbyTesting.jar to
derby_tests.policy file:
grant codeBase "${derbyTesting.codejar}derbyTesting.jar" {
  // Required for upgrade test
  permission java.lang.RuntimePermission "createClassLoader";
  permission java.lang.RuntimePermission "setContextClassLoader";
  .
  .
  .
}

Are the above solutions acceptable?

I would appreciate if someone can answer these questions and provide
suggestions about how to proceed.

Thanks,
Deepa