[jira] [Commented] (DERBY-7126) Make it possible to build and test Derby cleanly with OpenJDK 18

2021-12-01 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas commented on DERBY-7126:


Attaching derby-7126-04-aa-makeTestsRunOnJDK11andJDK18.diff. This patch adjusts 
the tests so that they run cleanly on both JDK 11 and 18 build 18-ea+23-1525. 
With these changes, Derby builds cleanly on both JDK 11 and JDK 18--that 
includes the javadoc.

The chief challenge was that the java.security.manager property has changed 
meaning between JDK 11 and JDK 18. JDK 11 interprets the property as the name 
of a user-written class which replaces the SecurityManager. JDK 18 interprets 
the property as a gate on whether the application is allowed to install a 
SecurityManager. You CAN'T set that property when running on JDK 11 and you 
MUST set that property when running on JDK 18.

To test these changes, I built Derby with JDK 18 build 18-ea+23-1525 and ran 
the following tests on JDK 11 and JDK 18:

o The old harness tests with both the classpath and the modulepath (from my own 
scripts, setting java.security.manager=allow only if the platform was JDK 18).
o The JUnit tests with both the classpath and the modulepath (from my own 
scripts, setting java.security.manager=allow only if the platform was JDK 18).
o ant junit-all
o ant test-derbyall
o ant test-derbyall-with-modulepath
o ant test-junit-all-with-modulepath

I saw one error in XMLBindingTest when running the JUnit tests under ant. The 
error occurs when you run XMLBindingTest standalone using the junit-single 
target. The error was not introduced by my changes: it occurs when you run 
XMLBindingTest under ant on JDK 11 without my changes. This is the error:

{noformat}
  
java.sql.SQLDataException: 
Invalid XML Document: access denied (java.io.FilePermission 
/Users/rhillegas/derby/mainline/trunk/junit_20211126_1247/extin/personal.dtd
 read)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:84)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:141)
at org.apache.derby.impl.jdbc.Util.seeNextException(Util.java:252)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(TransactionResourceImpl.java:438)
at 
org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(TransactionResourceImpl.java:360)
at 
org.apache.derby.impl.jdbc.EmbedConnection.handleException(EmbedConnection.java:2405)
at 
org.apache.derby.impl.jdbc.ConnectionChild.handleException(ConnectionChild.java:88)
at 
org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(EmbedStatement.java:1436)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(EmbedPreparedStatement.java:1709)
at 
org.apache.derby.impl.jdbc.EmbedPreparedStatement.execute(EmbedPreparedStatement.java:1394)
at org.apache.derbyTesting.junit.XML.insertDocWithDTD(XML.java:206)
at 
org.apache.derbyTesting.functionTests.tests.lang.XMLBindingTest$XBindTestSetup.setUp(XMLBindingTest.java:306)
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:60)
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)
Caused by: ERROR 2200M: Invalid XML Document: access denied 
(java.io.FilePermission 
/Users/rhillegas/derby/mainline/trunk/junit_20211126_1247/extin/personal.dtd
 read)
at 
org.apache.derby.shared.common.error.StandardException.newException(StandardException.java:300)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(SQLExceptionFactory.java:170)
at 
org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(SQLExceptionFactory.java:75)
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/Users/rhillegas/derby/mainline/trunk/junit_20211126_1247/extin/personal.dtd
 read)
at 
java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:485)
at 
java.base/java.security.AccessController.checkPermission(AccessController.java:1068)
at 
java.base/java.lang.SecurityManager.checkPermission(SecurityManager.java:411)
at 
java.base/java.lang.SecurityManager.checkRead(SecurityManager.java:751)
at java.base/java.io.File.isDirectory(File.java:860)
at 

[jira] [Updated] (DERBY-7126) Make it possible to build and test Derby cleanly with OpenJDK 18

2021-12-01 Thread Richard N. Hillegas (Jira)


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

Richard N. Hillegas updated DERBY-7126:
---
Attachment: derby-7126-04-aa-makeTestsRunOnJDK11andJDK18.diff

> Make it possible to build and test Derby cleanly with OpenJDK 18
> 
>
> Key: DERBY-7126
> URL: https://issues.apache.org/jira/browse/DERBY-7126
> Project: Derby
>  Issue Type: Task
>  Components: Build tools
>Affects Versions: 10.16.0.0
>Reporter: Richard N. Hillegas
>Assignee: Richard N. Hillegas
>Priority: Major
> Attachments: DERBY_7126_A.java, DERBY_7126_B.java, dcl_emc2sm.jar, 
> derby-7126-01-aa-regenerateSignedJars.diff, 
> derby-7126-02-aa-suppressDeprecationWarnings.diff, 
> derby-7126-03-aa-mention-java.security.manager.diff, 
> derby-7126-04-aa-makeTestsRunOnJDK11andJDK18.diff
>
>
> Releases of Open JDK 18 can be found at https://jdk.java.net/178. We should 
> adjust Derby as necessary so that it builds cleanly (including javadoc) and 
> tests cleanly with this version of the platform.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)