[ 
https://issues.apache.org/jira/browse/DERBY-6881?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15219567#comment-15219567
 ] 

ASF subversion and git services commented on DERBY-6881:
--------------------------------------------------------

Commit 1737188 from [~knutanders] in branch 'code/trunk'
[ https://svn.apache.org/r1737188 ]

DERBY-6881: Test failures with JDK 9-ea b111

ClassLoaderTestSetup casts the context class loader to URLClassLoader
in order to create a new URLClassLoader with the same URLs as the
original class loader. In JDK 9, the context class loader is no longer
a URLClassLoader after JEP 261. This code now results in a
ClassCastException.

The point of ClassLoaderTestSetup is to change the context class
loader to something which is not the system class loader. It does not
have to be a clone of the original context class loader. This patch
therefore changes ClassLoaderTestSetup so that it sets the context
class loader to an empty URLClassLoader which wraps the system class
loader. This avoids the unreliable cast and the resulting
ClassCastException.

> Test failures with JDK 9-ea b111
> --------------------------------
>
>                 Key: DERBY-6881
>                 URL: https://issues.apache.org/jira/browse/DERBY-6881
>             Project: Derby
>          Issue Type: Bug
>          Components: Test
>    Affects Versions: 10.13.0.0
>            Reporter: Knut Anders Hatlen
>         Attachments: d6881-classloader.diff, d6881-sed.diff
>
>
> With JDK 9-ea b111 there are a number of test failures.
> Tests that use ClassLoaderTestSetup fail because the context class loader no 
> longer is a URLClassLoader, which causes a ClassCastException in the class 
> loader magic performed by the test setup:
> {noformat}
> java.lang.ClassCastException: jdk.internal.loader.ClassLoaders$AppClassLoader 
> (in module: java.base) cannot be cast to java.net.URLClassLoader (in module: 
> java.base)
>       at 
> org.apache.derbyTesting.junit.ClassLoaderTestSetup$1.run(ClassLoaderTestSetup.java:53)
>       at 
> org.apache.derbyTesting.junit.ClassLoaderTestSetup$1.run(ClassLoaderTestSetup.java:50)
>       at java.security.AccessController.doPrivileged(java.base@9-ea/Native 
> Method)
>       at 
> org.apache.derbyTesting.junit.ClassLoaderTestSetup.makeClassLoader(ClassLoaderTestSetup.java:49)
>       at 
> org.apache.derbyTesting.junit.ClassLoaderTestSetup.setUp(ClassLoaderTestSetup.java:64)
>       at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
>       at junit.extensions.TestSetup.run(TestSetup.java:25)
>       at 
> org.apache.derbyTesting.junit.BaseTestSetup.run(BaseTestSetup.java:58)
> {noformat}
> CollationTest, CollationTest2, LocalizedAttributeScriptTest and 
> LocalizedDisplayScriptTest have failures, for example:
> {noformat}
> junit.framework.AssertionFailedError: Column value mismatch @ column 'ID', 
> row 1:
>     Expected: >4<
>     Found:    >6<
>     ID,NAME
>     -- ----
>    [6, aacorn]
>    [4, Acorn]
>    [2, Ącorn]
>    [0, Smith]
>    [5, Śmith]
>    [1, Zebra]
>    [3, Żebra]
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.newAssertionFailedError(BaseTestCase.java:1177)
>       at org.apache.derbyTesting.junit.JDBC.addRsToReport(JDBC.java:1998)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1497)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1395)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertFullResultSetMinion(JDBC.java:1257)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:1168)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:1125)
>       at 
> org.apache.derbyTesting.junit.JDBC.assertFullResultSet(JDBC.java:1083)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.CollationTest.checkLangBasedQuery(CollationTest.java:2055)
>       at 
> org.apache.derbyTesting.functionTests.tests.lang.CollationTest.testNorwayCollation(CollationTest.java:482)
>       at 
> org.apache.derbyTesting.junit.BaseTestCase.runBare(BaseTestCase.java:120)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBareOverridable(BaseJDBCTestCase.java:443)
>       at 
> org.apache.derbyTesting.junit.BaseJDBCTestCase.runBare(BaseJDBCTestCase.java:460)
>       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 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:58)
>       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)
> Caused by: junit.framework.AssertionFailedError: Column value mismatch @ 
> column 'ID', row 1:
>     Expected: >4<
>     Found:    >6<
>       at 
> org.apache.derbyTesting.junit.JDBC.assertRowInResultSet(JDBC.java:1492)
> {noformat}
> And the stack trace deletion patterns in the Sed class seem to be missing out 
> on some stack frames now, causing failures like this one in dblook_test and 
> dblook_test_territory:
> {noformat}
> ********* Diff file derbyall/derbytools/dblook_test.diff
> *** Start: dblook_test jdk9-ea derbyall:derbytools 2016-03-29 14:16:38 ***
> 6511a6512
> >     at java.io.FileInputStream.open0(java.base@9-ea/Native Method)
> Test Failed.
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to