From aac6510098081f67b5fecef629fe7c978df5fa3f Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Mon, 11 Jun 2012 17:46:54 +0800 Subject: [PATCH] HHH-7380 bug when initialize MULTI_TENANT_IDENTIFIER_RESOLVER and CUSTOM_ENTITY_DIRTINESS_STRATEGY --- .../internal/SessionFactoryImpl.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java index bdc6c6400c..866c4f9858 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java @@ -589,7 +589,7 @@ public final class SessionFactoryImpl } Class customEntityDirtinessStrategyClass; if ( Class.class.isInstance( value ) ) { - customEntityDirtinessStrategyClass = Class.class.cast( customEntityDirtinessStrategy ); + customEntityDirtinessStrategyClass = Class.class.cast( value ); } else { try { @@ -663,7 +663,7 @@ public final class SessionFactoryImpl Class implClass; if ( Class.class.isInstance( value ) ) { - implClass = Class.class.cast( customEntityDirtinessStrategy ); + implClass = Class.class.cast( value ); } else { try { @@ -677,17 +677,17 @@ public final class SessionFactoryImpl return null; } } - - try { - return implClass.newInstance(); + if ( implClass != null ) { + try { + return implClass.newInstance(); + } + catch ( Exception e ) { + LOG.debugf( + "Unable to instantiate CurrentTenantIdentifierResolver class %s", + implClass.getName() + ); + } } - catch (Exception e) { - LOG.debugf( - "Unable to instantiate CurrentTenantIdentifierResolver class %s", - implClass.getName() - ); - } - return null; }