[
http://issues.apache.org/jira/browse/DERBY-885?page=comments#action_12364282 ]
Daniel John Debrunner commented on DERBY-885:
---------------------------------------------
The issue is that when a SecurityManager is installed with the J9 virutal
machine it does not pick up grants of permissions from the file defined by the
system property java.security.policy unless that property is set on the command
line, whereas other jvm's do.
This fails with a security exception
j9 -Dabcd.efgh=hello x
but this one completes ok
j9 -Djava.security.policy=my.policy -Dabcd.efgh=hello x
Now, I have to admit I haven't been able to find a good defintion of the
relationship of the system property java.security.policy to the SecurityManager
class, or any description what is the exact defined behaviour for:
System.setSecurityManager(new SecurityManager());
There seems to be no good documentation (that I can find) saying exactly where
this security manager will pick its permissions from.
x.java
=====
public class x
{
public static void main(String[] args)
{
System.setProperty("java.security.policy", "my.policy");
System.out.println("abcd.efgh=" + System.getProperty("abcd.efgh"));
System.setSecurityManager(new SecurityManager());
System.out.println("installed security manager");
System.out.println("abcd.efgh=" + System.getProperty("abcd.efgh"));
}
}
my.policy
=======
grant {
permission java.util.PropertyPermission "abcd.*", "read";
};
> Test harness aborts with exception when running nist test suite in J2ME
> -----------------------------------------------------------------------
>
> Key: DERBY-885
> URL: http://issues.apache.org/jira/browse/DERBY-885
> Project: Derby
> Type: Test
> Components: Regression Test Failure
> Versions: 10.2.0.0
> Environment: IBM WCTME 5.7 j9 foundation VM
> Reporter: Deepa Remesh
> Assignee: Daniel John Debrunner
>
> The first test in nist suite (schema1.sql) fails with following exception:
> RunIJ --> java.security.AccessControlException: Access denied
> (java.io.FilePermission
> C:\deepa\Derby\derby_testing\j9foun_nist\nist\schema1_app.properties read)
> java.security.AccessControlException: Access denied (java.io.FilePermission
> C:\deepa\Derby\derby_testing\j9foun_nist\nist\schema1_app.properties read)
> at
> java.security.AccessController.checkPermission(AccessController.java:74)
> at java.lang.SecurityManager.checkPermission(SecurityManager.java:612)
> at java.lang.SecurityManager.checkRead(SecurityManager.java:395)
> at java.io.FileInputStream.<init>(FileInputStream.java:90)
> at org.apache.derby.impl.tools.ij.util.getPropertyArg(util.java:120)
> at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:91)
> at org.apache.derby.impl.tools.ij.Main.main(Main.java:75)
> at org.apache.derby.tools.ij.main(ij.java:56)
> at
> org.apache.derbyTesting.functionTests.harness.RunIJ.run(RunIJ.java:44)
> at java.lang.Thread.run(Thread.java:795)
> java.security.AccessControlException: Access denied
> (java.util.PropertyPermission * read,write)
> at
> java.security.AccessController.checkPermission(AccessController.java:74)
> at java.lang.SecurityManager.checkPermission(SecurityManager.java:612)
> at
> java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:353)
> at java.lang.System.getProperties(System.java:252)
> at
> org.apache.derbyTesting.functionTests.harness.RunTest.execTestNoProcess(RunTest.java:2324)
> at
> org.apache.derbyTesting.functionTests.harness.RunTest.testRun(RunTest.java:442)
> at
> org.apache.derbyTesting.functionTests.harness.RunTest.main(RunTest.java:301)
> at
> org.apache.derbyTesting.functionTests.harness.RunList.runTests(RunList.java:550)
> at
> org.apache.derbyTesting.functionTests.harness.RunList.runSuites(RunList.java:306)
> at
> org.apache.derbyTesting.functionTests.harness.RunList.<init>(RunList.java:160)
> at
> org.apache.derbyTesting.functionTests.harness.RunSuite.getSuitesList(RunSuite.java:186)
> at
> org.apache.derbyTesting.functionTests.harness.RunSuite.main(RunSuite.java:146)
> I think this is happening after the change to install a SecurityManager when
> useprocess=false is specified. This property is specified in the properties
> file for nist suite. Before this change, security manager was not used when
> running tests in J2ME.
> Since this exception causes the test harness to exit, derbyall cannot be
> completed in this environment.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira