Remove SecurityManager support
Closes gh-28213
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.boot;
|
||||
|
||||
import java.security.AccessControlException;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -84,12 +83,7 @@ class SpringApplicationShutdownHook implements Runnable {
|
||||
}
|
||||
|
||||
void addRuntimeShutdownHook() {
|
||||
try {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this, "SpringApplicationShutdownHook"));
|
||||
}
|
||||
catch (AccessControlException ex) {
|
||||
// Not allowed in some environments
|
||||
}
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(this, "SpringApplicationShutdownHook"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -82,7 +82,6 @@ public class TomcatEmbeddedWebappClassLoader extends ParallelWebappClassLoader {
|
||||
}
|
||||
|
||||
private Class<?> doLoadClass(String name) throws ClassNotFoundException {
|
||||
checkPackageAccess(name);
|
||||
if ((this.delegate || filter(name, true))) {
|
||||
Class<?> result = loadFromParent(name);
|
||||
return (result != null) ? result : findClassIgnoringNotFound(name);
|
||||
@@ -127,15 +126,4 @@ public class TomcatEmbeddedWebappClassLoader extends ParallelWebappClassLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPackageAccess(String name) throws ClassNotFoundException {
|
||||
if (this.securityManager != null && name.lastIndexOf('.') >= 0) {
|
||||
try {
|
||||
this.securityManager.checkPackageAccess(name.substring(0, name.lastIndexOf('.')));
|
||||
}
|
||||
catch (SecurityException ex) {
|
||||
throw new ClassNotFoundException("Security Violation, attempt to use Restricted Class: " + name, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user