HHH-11067 : Fix to work with JDK6 souce

(cherry picked from commit df2432d684)
This commit is contained in:
Gail Badner 2016-09-15 14:44:04 -07:00
parent 4c04d35b4c
commit 4a2993211b
1 changed files with 4 additions and 3 deletions

View File

@ -297,17 +297,18 @@ public class ThreadLocalSessionContext extends AbstractCurrentSessionContext {
final String methodName = method.getName();
// first check methods calls that we handle completely locally:
if ( "equals".equals( methodName ) && method.getParameterCount() == 1 ) {
final int parameterCount = method.getParameterTypes().length;
if ( "equals".equals( methodName ) && parameterCount == 1 ) {
if ( args[0] == null
|| !Proxy.isProxyClass( args[0].getClass() ) ) {
return false;
}
return this.equals( Proxy.getInvocationHandler( args[0] ) );
}
else if ( "hashCode".equals( methodName ) && method.getParameterCount() == 0 ) {
else if ( "hashCode".equals( methodName ) && parameterCount == 0 ) {
return this.hashCode();
}
else if ( "toString".equals( methodName ) && method.getParameterCount() == 0 ) {
else if ( "toString".equals( methodName ) && parameterCount == 0 ) {
return String.format( Locale.ROOT, "ThreadLocalSessionContext.TransactionProtectionWrapper[%s]", realSession );
}