From 3e59f961fcaf579a4424584f0e01364f632d2b0a Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Wed, 22 May 2013 16:20:52 -0700 Subject: [PATCH] HHH-8261 missing null check of type definition parameters --- .../org/hibernate/metamodel/internal/source/hbm/Helper.java | 2 +- .../org/hibernate/metamodel/spi/binding/TypeDefinition.java | 4 +++- .../java/org/hibernate/test/cut/CompositeUserTypeTest.java | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java index d327d55da7..d948a3a53e 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/source/hbm/Helper.java @@ -261,7 +261,7 @@ public class Helper { public static Map extractParameters(List xmlParamElements) { if ( xmlParamElements == null || xmlParamElements.isEmpty() ) { - return null; + return Collections.emptyMap(); } final HashMap params = new HashMap(); for ( JaxbParamElement paramElement : xmlParamElements ) { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/TypeDefinition.java b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/TypeDefinition.java index 500ea738fc..13d6896bd2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/TypeDefinition.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/spi/binding/TypeDefinition.java @@ -46,7 +46,9 @@ public class TypeDefinition implements Serializable { this.name = name; this.typeImplementorClass = typeImplementorClass; this.registrationKeys= registrationKeys; - this.parameters = Collections.unmodifiableMap( parameters ); + this.parameters = parameters == null ? Collections.emptyMap() : Collections.unmodifiableMap( + parameters + ); } public String getName() { diff --git a/hibernate-core/src/test/java/org/hibernate/test/cut/CompositeUserTypeTest.java b/hibernate-core/src/test/java/org/hibernate/test/cut/CompositeUserTypeTest.java index 8ae33f1d55..973ad24b01 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/cut/CompositeUserTypeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/cut/CompositeUserTypeTest.java @@ -44,7 +44,7 @@ import static org.junit.Assert.assertEquals; /** * @author Gavin King */ -@FailureExpectedWithNewMetamodel +//@FailureExpectedWithNewMetamodel public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase { @Override public String[] getMappings() {