mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8244473: Contextualize registration for JNDI
Also reviewed by Chris Ries <chris.ries@oracle.com> Reviewed-by: dfuchs, rriggs, rhalade, skoivu, mullan
This commit is contained in:
parent
f47faf283b
commit
17a741d6bc
8 changed files with 251 additions and 13 deletions
|
@ -31,6 +31,8 @@ import java.security.PrivilegedAction;
|
|||
import java.util.*;
|
||||
|
||||
import javax.naming.*;
|
||||
|
||||
import com.sun.naming.internal.ObjectFactoriesFilter;
|
||||
import com.sun.naming.internal.VersionHelper;
|
||||
import com.sun.naming.internal.ResourceManager;
|
||||
import com.sun.naming.internal.FactoryEnumeration;
|
||||
|
@ -147,7 +149,11 @@ public class NamingManager {
|
|||
|
||||
// Try to use current class loader
|
||||
try {
|
||||
clas = helper.loadClass(factoryName);
|
||||
clas = helper.loadClassWithoutInit(factoryName);
|
||||
// Validate factory's class with the objects factory serial filter
|
||||
if (!ObjectFactoriesFilter.canInstantiateObjectsFactory(clas)) {
|
||||
return null;
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
// ignore and continue
|
||||
// e.printStackTrace();
|
||||
|
@ -160,6 +166,11 @@ public class NamingManager {
|
|||
(codebase = ref.getFactoryClassLocation()) != null) {
|
||||
try {
|
||||
clas = helper.loadClass(factoryName, codebase);
|
||||
// Validate factory's class with the objects factory serial filter
|
||||
if (clas == null ||
|
||||
!ObjectFactoriesFilter.canInstantiateObjectsFactory(clas)) {
|
||||
return null;
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue