From df2432d68426a40c0e2ef8d8412b8a90820096c5 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Thu, 15 Sep 2016 14:44:04 -0700 Subject: [PATCH] HHH-11067 : Fix to work with JDK6 souce --- .../context/internal/ThreadLocalSessionContext.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java index c9387a14df..1fe6b99e34 100644 --- a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java @@ -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 ); }