From 70a1e23a38c5eb734d30b019205a08a03a0fe68d Mon Sep 17 00:00:00 2001 From: Karl von Randow Date: Tue, 18 Jun 2013 15:12:43 -0700 Subject: [PATCH] HHH-8428 Protect SessionFactoryRegistry.getNamedSessionFactory(String) from NPE --- .../java/org/hibernate/internal/SessionFactoryRegistry.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java index 41dcfdeb71..bb088710d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryRegistry.java @@ -132,7 +132,11 @@ public class SessionFactoryRegistry { public SessionFactory getNamedSessionFactory(String name) { LOG.debugf( "Lookup: name=%s", name ); final String uuid = nameUuidXref.get( name ); - return getSessionFactory( uuid ); + if ( uuid != null ) { + return getSessionFactory( uuid ); + } else { + return null; + } } public SessionFactory getSessionFactory(String uuid) {