HHH-15655 use privileged operation when defining classes
Signed-off-by: Scott Marlow <smarlow@redhat.com>
This commit is contained in:
parent
11b968a2ee
commit
8f2325ed4a
|
@ -192,10 +192,24 @@ public final class ByteBuddyState {
|
||||||
return cache.findOrInsert(
|
return cache.findOrInsert(
|
||||||
referenceClass.getClassLoader(),
|
referenceClass.getClassLoader(),
|
||||||
cacheKey,
|
cacheKey,
|
||||||
() -> make( makeProxyFunction.apply( byteBuddy ) )
|
() -> {
|
||||||
.load( referenceClass.getClassLoader(), resolveClassLoadingStrategy( referenceClass ) )
|
PrivilegedAction<Class<?>> delegateToPrivilegedAction = new PrivilegedAction<Class<?>>() {
|
||||||
.getLoaded(),
|
@Override
|
||||||
cache );
|
public Class<?> run() {
|
||||||
|
return make( makeProxyFunction.apply( byteBuddy ) )
|
||||||
|
.load(
|
||||||
|
referenceClass.getClassLoader(),
|
||||||
|
resolveClassLoadingStrategy( referenceClass )
|
||||||
|
)
|
||||||
|
.getLoaded();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return SystemSecurityManager.isSecurityManagerEnabled() ? AccessController.doPrivileged(
|
||||||
|
delegateToPrivilegedAction ) :
|
||||||
|
delegateToPrivilegedAction.run();
|
||||||
|
},
|
||||||
|
cache
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Unloaded<?> make(Function<ByteBuddy, DynamicType.Builder<?>> makeProxyFunction) {
|
public Unloaded<?> make(Function<ByteBuddy, DynamicType.Builder<?>> makeProxyFunction) {
|
||||||
|
|
Loading…
Reference in New Issue