This is an automated email from the ASF dual-hosted git repository.

snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git


The following commit(s) were added to refs/heads/main by this push:
     new 0a2f9df4 Make tests work with Java 23 (#723)
0a2f9df4 is described below

commit 0a2f9df435cde79f65fed49a20a40bd96f5d1f37
Author: Robert Stupp <[email protected]>
AuthorDate: Tue Jan 14 12:10:28 2025 +0100

    Make tests work with Java 23 (#723)
    
    Example stack trace from Java 23:
    
    ```
    getSubject is supported only if a security manager is allowed
    java.lang.UnsupportedOperationException: getSubject is supported only if a 
security manager is allowed
            at 
java.base/javax.security.auth.Subject.getSubject(Subject.java:347)
            at 
org.apache.hadoop.security.UserGroupInformation.getCurrentUser(UserGroupInformation.java:588)
            at 
org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:3888)
            at 
org.apache.hadoop.fs.FileSystem$Cache$Key.<init>(FileSystem.java:3878)
            at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:3666)
            at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:557)
            at org.apache.hadoop.fs.Path.getFileSystem(Path.java:366)
            at org.apache.iceberg.hadoop.Util.getFs(Util.java:56)
            at 
org.apache.iceberg.hadoop.HadoopOutputFile.fromPath(HadoopOutputFile.java:53)
            at 
org.apache.iceberg.hadoop.HadoopFileIO.newOutputFile(HadoopFileIO.java:97)
            at 
org.apache.polaris.service.dropwizard.catalog.io.TestFileIO.newOutputFile(TestFileIO.java:114)
            at 
org.apache.iceberg.BaseMetastoreTableOperations.writeNewMetadata(BaseMetastoreTableOperations.java:155)
            at 
org.apache.iceberg.BaseMetastoreTableOperations.writeNewMetadataIfRequired(BaseMetastoreTableOperations.java:150)
            at 
org.apache.polaris.service.catalog.BasePolarisCatalog$BasePolarisTableOperations.doCommit(BasePolarisCatalog.java:1343)
            at 
org.apache.iceberg.BaseMetastoreTableOperations.commit(BaseMetastoreTableOperations.java:125)
            at 
org.apache.iceberg.BaseMetastoreCatalog$BaseMetastoreCatalogTableBuilder.create(BaseMetastoreCatalog.java:201)
            at 
org.apache.iceberg.rest.CatalogHandlers.createTable(CatalogHandlers.java:274)
            at 
org.apache.polaris.service.catalog.PolarisCatalogHandlerWrapper.lambda$createTableDirect$13(PolarisCatalogHandlerWrapper.java:588)
            at 
org.apache.polaris.service.catalog.PolarisCatalogHandlerWrapper.doCatalogOperation(PolarisCatalogHandlerWrapper.java:517)
            at 
org.apache.polaris.service.catalog.PolarisCatalogHandlerWrapper.createTableDirect(PolarisCatalogHandlerWrapper.java:588)
            at 
org.apache.polaris.service.catalog.IcebergCatalogAdapter.createTable(IcebergCatalogAdapter.java:258)
            at 
org.apache.polaris.service.catalog.api.IcebergRestCatalogApi.createTable(IcebergRestCatalogApi.java:205)
            at 
org.apache.polaris.service.dropwizard.admin.PolarisOverlappingTableTest.createTable(PolarisOverlappingTableTest.java:61)
            at 
org.apache.polaris.service.dropwizard.admin.PolarisOverlappingTableTest.testTableLocationRestrictions(PolarisOverlappingTableTest.java:153)
    ```
    
    Note that `javax.security.auth.Subject#getSubject` is deprecated for 
removal since Java 17.
    
    `java.lang.System#initPhase3` shows that setting `java.security.manager` to 
`allow` works around the UOE.
---
 quarkus/service/build.gradle.kts | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/quarkus/service/build.gradle.kts b/quarkus/service/build.gradle.kts
index 794f317c..94ced9bf 100644
--- a/quarkus/service/build.gradle.kts
+++ b/quarkus/service/build.gradle.kts
@@ -146,7 +146,9 @@ tasks.named<Test>("test").configure {
   // Note: the test secrets are referenced in DropwizardServerManager
   environment("POLARIS_BOOTSTRAP_CREDENTIALS", 
"POLARIS,root,test-admin,test-secret")
   jvmArgs("--add-exports", "java.base/sun.nio.ch=ALL-UNNAMED")
-  useJUnitPlatform()
+  // Need to allow a java security manager after Java 21, for 
Subject.getSubject to work
+  // "getSubject is supported only if a security manager is allowed".
+  systemProperty("java.security.manager", "allow")
   maxParallelForks = 4
 }
 

Reply via email to