reflections
reflections copied to clipboard
Access denied when using a security manager
When using 0.10.x, and running with a security manager, trying to use new Reflections(scanPrefix) results in an AccessControlException, like this one:
Feb. 26, 2022 10:48:08 PM org.reflections.vfs.Vfs fromURL
WARNING: could not create Dir using jarUrl from url jar:file:<path to JAR file>.jar!/. skipping.
java.security.AccessControlException: access denied ("java.io.FilePermission" "file:/<path to JAR file>.jar!" "read")
at java.base/java.security.AccessControlContext.checkPermission(AccessControlContext.java:472)
at java.base/java.security.AccessController.checkPermission(AccessController.java:897)
...
This happens even with a policy file that grants all permissions.
It works fine with 0.9.11
Arguments to the JVM: -Djava.security.manager=default -Djava.security.policy=all_perms.policy
Example policy file: all_perms.policy.txt
I can reproduce the problem in a unit test, but that test is a bit much to drop in here. I'll try and create a standalone project that reproduces the problem.