[ 
https://issues.apache.org/jira/browse/DERBY-2813?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Kathey Marsden updated DERBY-2813:
----------------------------------

    Attachment: derby-2813_betterassert_diff.txt

Attaching a patch that just gives a better assert when run with security 
manager. The new assertion shows that the ClassLoader of the datasource is 
wrong instead of indicating dual boot.  Also changes an instance of 
getContextClassLoader to be in a privilege block and fixes up a couple comments.

I can't quite figure out why we are not getting the right class loader with 
security manager.  setContextClassLoader seems to be executing properly but for 
some reason the instantiated data source does not pick it up, but I will go 
ahead and check in this patch as at least it makes the real problem clearer. 
The new  failure with security manager on is 

1) 
testBootingAnAlreadyBootedDatabase(org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest)junit.framew
ork.AssertionFailedError: 
expected:<org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest$DerbyURLClassL
oader@b1b0b1b> but was:<sun.misc.Launcher$AppClassLoader@1e261e26>
        at 
org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest.testBootingAnAlreadyBootedDatabase(Clas
sLoaderBootTest.java:174)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:439)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:456)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
2) 
testBootingDatabaseShutdownByAnotherCLR(org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest)junit.f
ramework.AssertionFailedError: 
expected:<org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest$DerbyURLC
lassLoader@48874887> but was:<sun.misc.Launcher$AppClassLoader@1e261e26>
        at 
org.apache.derbyTesting.functionTests.tests.store.ClassLoaderBootTest.testBootingDatabaseShutdownByAnotherCLR
(ClassLoaderBootTest.java:207)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
        at 
org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:117)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:439)
        at 
org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:456)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)
        at 
org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:57)
        at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
        at junit.extensions.TestSetup$1.protect(TestSetup.java:21)
        at junit.extensions.TestSetup.run(TestSetup.java:25)

FAILURES!!!
Tests run: 2,  Failures: 2,  Errors: 0


> store/ClassLoaderBootTest fixture testBootingAnAlreadyBootedDatabase fails 
> indicating derby booted a database that was already booted by another CLR if 
> security manager is on
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: DERBY-2813
>                 URL: https://issues.apache.org/jira/browse/DERBY-2813
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.3.1.4, 10.11.0.0
>         Environment: The test ClassLoaderBoot test currently runs without 
> security manager. Security manager needs to be enabled.
>            Reporter: Kathey Marsden
>              Labels: derby_triage10_11
>         Attachments: derby-2813_betterassert_diff.txt
>
>




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to