From 8298390dc69ab3ba29950848002a426c123c74d9 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Wed, 14 Oct 2015 16:28:30 +0100 Subject: [PATCH] HHH-10198 - NPE in InformationExtractorJdbcDatabaseMetaDataImpl --- ...nformationExtractorJdbcDatabaseMetaDataImpl.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java index cc0913f2da..9aaa25a7aa 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/schema/extract/internal/InformationExtractorJdbcDatabaseMetaDataImpl.java @@ -124,10 +124,13 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information } if ( resultSet.next() ) { + final String catalogName = catalog == null ? "" : catalog.getCanonicalName(); + final String schemaName = schema == null ? "" : schema.getCanonicalName(); + log.debugf( "Multiple schemas found with that name [%s.%s]", - catalog.getCanonicalName(), - schema.getCanonicalName() + catalogName, + schemaName ); } return true; @@ -344,12 +347,14 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information if ( resultSet.next() ) { log.multipleTablesFound( tableName.render() ); + final String catalogName = catalog == null ? "" : catalog.render(); + final String schemaName = schema == null ? "" : schema.render(); throw new SchemaExtractionException( String.format( Locale.ENGLISH, "More than one table found in namespace (%s, %s) : %s", - catalog.render(), - schema.render(), + catalogName, + schemaName, tableName.render() ) );