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 Sean Qiu <se...@gmail.com> on 2007/07/09 09:08:56 UTC
[test] Junit test fail and throw AccessControlException
Hi,guys
I build the derby source code successfully, and then run the junit test with
"ant juni-core", but It will fail and throw AccessControlException[1].
SecurityManagerSetup will install a SecurityManager with policy file
of org/apache/derbyTesting/functionTests/util/derby_tests.policy.
Won't this policy file grant the code propor permission? or am i missing
some thing?
[1] Test failure message
[junit] Running
org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
[junit] Exception in thread "main" java.security.AccessControlException:
Access denied (java.io.FilePermission D:\at\derby\jun
itvmwatcher954993545.properties write)
[junit] at java.security.AccessController46checkPermission(
AccessController.java:103)
[junit] at java.lang.SecurityManager46checkPermission(
SecurityManager.java:532)
[junit] at java.lang.SecurityManager46checkWrite(
SecurityManager.java:962)
[junit] at java.io.FileOutputStream46<init>(FileOutputStream.java
:169)
[junit] at java.io.FileOutputStream46<init>(FileOutputStream.java
:70)
[junit] at java.io.FileWriter46<init>(FileWriter.java:46)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46registerTestCase
(JUnitTestRunner.java:940)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46access$000(
JUnitTestRunner.java:68)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$346startTest(
JUnitTestRunner.java:807)
[junit] at
org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$446startTest(
JUnitTestRunner.java:1005)
Thanks.
--
Sean Qiu
Re: [test] Junit test fail and throw AccessControlException
Posted by Daniel John Debrunner <dj...@apache.org>.
Sean Qiu wrote:
>
>
> 2007/7/9, Daniel John Debrunner <djd@apache.org <ma...@apache.org>>:
>
> Sean Qiu wrote:
> > How to run test without install an SecurityManager? "ant junit-core
> > - Djava.security.policy=<NONE>" ?
> > But it seems not work.
> >
> > 2007/7/9, Sean Qiu <sean.xx.qiu@gmail.com
> <ma...@gmail.com> <mailto: sean.xx.qiu@gmail.com
> <ma...@gmail.com>>>:
>
> I committed a change for this over the weekend (in trunk).
>
> Dan.
>
>
> Thanks,Dan
>
> BTW, why the test cannot get permission within default policy? Am i
> missing sth?
The test fixture required a permission which was not granted in the test
policy file. The change in this case was to run the test fixture without
a security manager because it was not testing Derby functionality or
calling into Derby code. It was testing indirectly to see if Derby was
running, which required looking at ThreadGroups.
HTH,
Dan.
Re: [test] Junit test fail and throw AccessControlException
Posted by Sean Qiu <se...@gmail.com>.
2007/7/9, Daniel John Debrunner <dj...@apache.org>:
>
> Sean Qiu wrote:
> > How to run test without install an SecurityManager? "ant junit-core
> > -Djava.security.policy=<NONE>" ?
> > But it seems not work.
> >
> > 2007/7/9, Sean Qiu <sean.xx.qiu@gmail.com <mailto:sean.xx.qiu@gmail.com
> >>:
>
> I committed a change for this over the weekend (in trunk).
>
> Dan.
>
Thanks,Dan
BTW, why the test cannot get permission within default policy? Am i missing
sth?
--
Sean Qiu
Re: [test] Junit test fail and throw AccessControlException
Posted by Daniel John Debrunner <dj...@apache.org>.
Sean Qiu wrote:
> How to run test without install an SecurityManager? "ant junit-core
> -Djava.security.policy=<NONE>" ?
> But it seems not work.
>
> 2007/7/9, Sean Qiu <sean.xx.qiu@gmail.com <ma...@gmail.com>>:
I committed a change for this over the weekend (in trunk).
Dan.
Re: [test] Junit test fail and throw AccessControlException
Posted by Leo Li <li...@gmail.com>.
On 7/9/07, Sean Qiu <se...@gmail.com> wrote:
> How to run test without install an SecurityManager? "ant junit-core
> -Djava.security.policy=<NONE>" ?
> But it seems not work.
>
I guess the security manager is installed by derby itself or its test.
> 2007/7/9, Sean Qiu <se...@gmail.com>:
> >
> > Hi,guys
> >
> > I build the derby source code successfully, and then run the junit test
> with "ant juni-core", but It will fail and throw AccessControlException[1].
> >
> > SecurityManagerSetup will install a SecurityManager with policy file of
> org/apache/derbyTesting/functionTests/util/derby_tests.policy.
> > Won't this policy file grant the code propor permission? or am i missing
> some thing?
> >
> >
> > [1] Test failure message
> > [junit] Running
> org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
> > [junit] Exception in thread "main"
> java.security.AccessControlException: Access denied
> (java.io.FilePermission D:\at\derby\jun
> > itvmwatcher954993545.properties write)
> > [junit] at
> java.security.AccessController46checkPermission(AccessController.java:103)
> > [junit] at
> java.lang.SecurityManager46checkPermission(SecurityManager.java
> :532)
> > [junit] at
> java.lang.SecurityManager46checkWrite(SecurityManager.java:962)
> > [junit] at
> java.io.FileOutputStream46<init>(FileOutputStream.java:169)
> > [junit] at java.io.FileOutputStream46
> <init>(FileOutputStream.java:70)
> > [junit] at java.io.FileWriter46<init>(FileWriter.java:46)
> > [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46registerTestCase(JUnitTestRunner.java
> :940)
> > [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46access$000(JUnitTestRunner.java:68)
> > [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$346startTest
> (JUnitTestRunner.java:807)
> > [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$446startTest(JUnitTestRunner.java:1005)
> >
> > Thanks.
> > --
> > Sean Qiu
>
>
>
> --
> Sean Qiu
--
Leo Li
China Software Development Lab, IBM
Re: [test] Junit test fail and throw AccessControlException
Posted by Sean Qiu <se...@gmail.com>.
How to run test without install an SecurityManager? "ant junit-core -D
java.security.policy=<NONE>" ?
But it seems not work.
2007/7/9, Sean Qiu <se...@gmail.com>:
>
> Hi,guys
>
> I build the derby source code successfully, and then run the junit test
> with "ant juni-core", but It will fail and throw AccessControlException[1].
>
> SecurityManagerSetup will install a SecurityManager with policy file
> of org/apache/derbyTesting/functionTests/util/derby_tests.policy.
> Won't this policy file grant the code propor permission? or am i missing
> some thing?
>
>
> [1] Test failure message
> [junit] Running
> org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadTest
> [junit] Exception in thread "main"
> java.security.AccessControlException: Access denied (
> java.io.FilePermission D:\at\derby\jun
> itvmwatcher954993545.properties write)
> [junit] at java.security.AccessController46checkPermission(
> AccessController.java:103)
> [junit] at java.lang.SecurityManager46checkPermission(
> SecurityManager.java :532)
> [junit] at java.lang.SecurityManager46checkWrite(
> SecurityManager.java:962)
> [junit] at java.io.FileOutputStream46<init>(FileOutputStream.java
> :169)
> [junit] at java.io.FileOutputStream46 <init>(FileOutputStream.java
> :70)
> [junit] at java.io.FileWriter46<init>(FileWriter.java:46)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46registerTestCase
> (JUnitTestRunner.java :940)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner46access$000(
> JUnitTestRunner.java:68)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$346startTest(
> JUnitTestRunner.java:807)
> [junit] at
> org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner$446startTest(
> JUnitTestRunner.java:1005)
>
> Thanks.
> --
> Sean Qiu
>
--
Sean Qiu