mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 00:19:11 +00:00
more fine-grained jython hack that also plays with java 9
This commit is contained in:
parent
38054ff4ee
commit
caab1df111
@ -88,14 +88,16 @@ public class BootstrapForTesting {
|
||||
// add permissions to everything in classpath
|
||||
for (URL url : ((URLClassLoader)BootstrapForTesting.class.getClassLoader()).getURLs()) {
|
||||
Path path = PathUtils.get(url.toURI());
|
||||
if (path.toString().endsWith(".jar")) {
|
||||
// jar itself
|
||||
perms.add(new FilePermission(path.toString(), "read,readlink"));
|
||||
// crazy jython...
|
||||
Security.addPath(perms, path.getParent().resolve("Lib"), "read,readlink");
|
||||
} else {
|
||||
// classes
|
||||
Security.addPath(perms, path, "read,readlink");
|
||||
// resource itself
|
||||
perms.add(new FilePermission(path.toString(), "read,readlink"));
|
||||
// classes underneath
|
||||
perms.add(new FilePermission(path.toString() + path.getFileSystem().getSeparator() + "-", "read,readlink"));
|
||||
|
||||
// crazy jython...
|
||||
String filename = path.getFileName().toString();
|
||||
if (filename.contains("jython") && filename.endsWith(".jar")) {
|
||||
// just enough so it won't fail when it does not exist
|
||||
perms.add(new FilePermission(path.getParent().resolve("Lib").toString(), "read,readlink"));
|
||||
}
|
||||
}
|
||||
// java.io.tmpdir
|
||||
|
Loading…
x
Reference in New Issue
Block a user