From aae9cd14a54eeeccf0a84f2e655b7d12dcc49325 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Tue, 16 Oct 2018 16:36:48 +0100 Subject: [PATCH] HHH-13047 Deprecate Environment#verifyProperties --- .../StandardServiceRegistryBuilder.java | 1 - .../java/org/hibernate/cfg/Environment.java | 24 ++++--------------- .../hibernate/internal/CoreMessageLogger.java | 6 ----- .../ManagedProviderConnectionHelper.java | 1 - ...paOrNativeBootstrapFunctionalTestCase.java | 1 - .../junit4/BaseCoreFunctionalTestCase.java | 1 - 6 files changed, 4 insertions(+), 30 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java index 82d04e3908..ac3c961e60 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/registry/StandardServiceRegistryBuilder.java @@ -281,7 +281,6 @@ public class StandardServiceRegistryBuilder { final Map settingsCopy = new HashMap(); settingsCopy.putAll( settings ); settingsCopy.put( org.hibernate.boot.cfgxml.spi.CfgXmlAccessService.LOADED_CONFIG_KEY, aggregatedCfgXml ); - Environment.verifyProperties( settingsCopy ); ConfigurationHelper.resolvePlaceHolders( settingsCopy ); return new StandardServiceRegistryImpl( diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index 900a9502b5..8c58cc4a6b 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -8,7 +8,6 @@ package org.hibernate.cfg; import java.io.IOException; import java.io.InputStream; -import java.util.HashMap; import java.util.Map; import java.util.Properties; @@ -160,28 +159,15 @@ public final class Environment implements AvailableSettings { private static final Properties GLOBAL_PROPERTIES; - private static final Map OBSOLETE_PROPERTIES = new HashMap(); - private static final Map RENAMED_PROPERTIES = new HashMap(); - /** - * Issues warnings to the user when any obsolete or renamed property names are used. + * No longer effective. * * @param configurationValues The specified properties. + * @deprecated without replacement. Such verification is best done ad hoc, case by case. */ + @Deprecated public static void verifyProperties(Map configurationValues) { - final Map propertiesToAdd = new HashMap(); - for ( Map.Entry entry : configurationValues.entrySet() ) { - final Object replacementKey = OBSOLETE_PROPERTIES.get( entry.getKey() ); - if ( replacementKey != null ) { - LOG.unsupportedProperty( entry.getKey(), replacementKey ); - } - final Object renamedKey = RENAMED_PROPERTIES.get( entry.getKey() ); - if ( renamedKey != null ) { - LOG.renamedProperty( entry.getKey(), renamedKey ); - propertiesToAdd.put( renamedKey, entry.getValue() ); - } - } - configurationValues.putAll( propertiesToAdd ); + //Obsolete and Renamed properties are no longer handled here } static { @@ -225,8 +211,6 @@ public final class Environment implements AvailableSettings { LOG.unableToCopySystemProperties(); } - verifyProperties(GLOBAL_PROPERTIES); - ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES); if ( ENABLE_BINARY_STREAMS ) { LOG.usingStreams(); diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java index 863471e24e..ed6eb5e9d9 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -1397,12 +1397,6 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Oracle 11g is not yet fully supported; using Oracle 10g dialect", id = 394) void unsupportedOracleVersion(); - @LogMessage(level = WARN) - @Message(value = "Usage of obsolete property: %s no longer supported, use: %s", id = 395) - void unsupportedProperty( - Object propertyName, - Object newPropertyName); - @LogMessage(level = INFO) @Message(value = "Updating schema", id = 396) void updatingSchema(); diff --git a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/ManagedProviderConnectionHelper.java b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/ManagedProviderConnectionHelper.java index 16773a9d0e..e61f7fd2f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/ManagedProviderConnectionHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/tool/hbm2ddl/ManagedProviderConnectionHelper.java @@ -49,7 +49,6 @@ class ManagedProviderConnectionHelper implements ConnectionHelper { } private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) { - Environment.verifyProperties( properties ); ConfigurationHelper.resolvePlaceHolders( properties ); return (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder().applySettings( properties ).build(); } diff --git a/hibernate-core/src/test/java/org/hibernate/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java b/hibernate-core/src/test/java/org/hibernate/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java index 732cd4c0d6..aaa2bcc772 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/test/exceptionhandling/BaseJpaOrNativeBootstrapFunctionalTestCase.java @@ -254,7 +254,6 @@ public abstract class BaseJpaOrNativeBootstrapFunctionalTestCase extends BaseUni private StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) { Properties properties = new Properties(); properties.putAll( configuration.getProperties() ); - Environment.verifyProperties( properties ); ConfigurationHelper.resolvePlaceHolders( properties ); StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder(); diff --git a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java index 3d6e2d66b5..e7f7918092 100644 --- a/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java +++ b/hibernate-testing/src/main/java/org/hibernate/testing/junit4/BaseCoreFunctionalTestCase.java @@ -267,7 +267,6 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase { protected StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) { Properties properties = new Properties(); properties.putAll( configuration.getProperties() ); - Environment.verifyProperties( properties ); ConfigurationHelper.resolvePlaceHolders( properties ); StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder();