mirror of https://github.com/apache/activemq.git
Merge pull request #565 from alevandoski/master
AMQ-8011 - Performance Related issue in ClassLoadingAwareObjectInputS…
This commit is contained in:
commit
02d4f8efec
|
@ -98,11 +98,15 @@ public class ClassLoadingAwareObjectInputStream extends ObjectInputStream {
|
|||
}
|
||||
|
||||
private void checkSecurity(Class clazz) throws ClassNotFoundException {
|
||||
if (!clazz.isPrimitive()) {
|
||||
if (clazz.getPackage() != null && !trustAllPackages()) {
|
||||
if (trustAllPackages() || clazz.isPrimitive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean found = false;
|
||||
for (String packageName : getTrustedPackages()) {
|
||||
if (clazz.getPackage().getName().equals(packageName) || clazz.getPackage().getName().startsWith(packageName + ".")) {
|
||||
Package thePackage = clazz.getPackage();
|
||||
if (thePackage != null) {
|
||||
for (String trustedPackage : getTrustedPackages()) {
|
||||
if (thePackage.getName().equals(trustedPackage) || thePackage.getName().startsWith(trustedPackage + ".")) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
@ -112,7 +116,6 @@ public class ClassLoadingAwareObjectInputStream extends ObjectInputStream {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException {
|
||||
// check for simple types first
|
||||
|
|
Loading…
Reference in New Issue