HHH-13277 Add a couple of comments
This commit is contained in:
parent
38a0cd2690
commit
89f523c87f
|
@ -17,6 +17,13 @@ import java.util.stream.Stream;
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This dispatcher analyzes the stack frames to detect if a particular call should be authorized.
|
||||||
|
* <p>
|
||||||
|
* Authorized classes are registered when creating the ByteBuddy proxies.
|
||||||
|
* <p>
|
||||||
|
* It should only be used when the Security Manager is enabled.
|
||||||
|
*/
|
||||||
public class HibernateMethodLookupDispatcher {
|
public class HibernateMethodLookupDispatcher {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,6 +100,7 @@ public class HibernateMethodLookupDispatcher {
|
||||||
public PrivilegedAction<Class<?>[]> run() {
|
public PrivilegedAction<Class<?>[]> run() {
|
||||||
Class<?> stackWalkerClass = null;
|
Class<?> stackWalkerClass = null;
|
||||||
try {
|
try {
|
||||||
|
// JDK 9 introduced the StackWalker
|
||||||
stackWalkerClass = Class.forName( "java.lang.StackWalker" );
|
stackWalkerClass = Class.forName( "java.lang.StackWalker" );
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e) {
|
catch (ClassNotFoundException e) {
|
||||||
|
@ -192,9 +200,9 @@ public class HibernateMethodLookupDispatcher {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
private final Function<Stream, Object> stackFrameExtractFunction = new Function<Stream, Object>() {
|
private final Function<Stream, Object> stackFrameExtractFunction = new Function<Stream, Object>() {
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
|
||||||
public Object apply(Stream stream) {
|
public Object apply(Stream stream) {
|
||||||
return stream.map( stackFrameGetDeclaringClassFunction )
|
return stream.map( stackFrameGetDeclaringClassFunction )
|
||||||
.limit( MAX_STACK_FRAMES )
|
.limit( MAX_STACK_FRAMES )
|
||||||
|
|
Loading…
Reference in New Issue