ComposableSecurityManagerPolicyTest.testParallelStreamsThreadingWithSecurityManager fails with Java 11. It looks like a workaround for ForkJoinPool (in ComposableSecurityManagerPolicy) no longer works properly.
I found a Stack Overflow post which seems to confirm a change between JDK 8 and JDK 11.
Here is the error output from running the test with Java 11:
testParallelStreamsThreadingWithSecurityManager(io.takari.builder.enforcer.ComposableSecurityManagerPolicyTest) Time elapsed: 0.019 s <<< FAILURE!
java.lang.AssertionError:
Expecting:
<["access denied ("java.util.PropertyPermission" "not.allowed" "read")",
"access denied ("java.util.PropertyPermission" "allowed" "read")",
"access denied ("java.util.PropertyPermission" "not.allowed" "read")",
null,
"access denied ("java.util.PropertyPermission" "not.allowed" "read")",
"access denied ("java.util.PropertyPermission" "allowed" "read")"]>
to contain exactly (and in same order):
<["nope", null, "nope", null, "nope", null]>
but some elements were not found:
<["nope", "nope", null, "nope", null]>
and others were not expected:
<["access denied ("java.util.PropertyPermission" "not.allowed" "read")",
"access denied ("java.util.PropertyPermission" "allowed" "read")",
"access denied ("java.util.PropertyPermission" "not.allowed" "read")",
"access denied ("java.util.PropertyPermission" "not.allowed" "read")",
"access denied ("java.util.PropertyPermission" "allowed" "read")"]>
at io.takari.builder.enforcer.ComposableSecurityManagerPolicyTest.testParallelStreamsThreadingWithSecurityManager(ComposableSecurityManagerPolicyTest.java:115)
A potential fix for the test is to simply wrap any async execution with a PrivilegedAction and run it within the outer's AccessControlContext.
ComposableSecurityManagerPolicyTest.testParallelStreamsThreadingWithSecurityManager
fails with Java 11. It looks like a workaround for ForkJoinPool (inComposableSecurityManagerPolicy
) no longer works properly.I found a Stack Overflow post which seems to confirm a change between JDK 8 and JDK 11.
Here is the error output from running the test with Java 11:
A potential fix for the test is to simply wrap any async execution with a
PrivilegedAction
and run it within the outer'sAccessControlContext
.testParallelStreamsThreadingWithSecurityManager
(line 108):